Previous Thread
Next Thread
Print Thread
Rate Thread
#260585 10/14/2003 1:33 AM
Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
It's me again

I'd like to add a query to my registered/unregistered header, but I only want it to run if it's on postlist.php and showflat.php..... Is there an if statement I can include with the query in the ubbt_registered.tmpl before the echo <<<UBBTPRINT to do that??

I'm thinking this is doable, but maybe not...
-peter

Sponsored Links
Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Anyone know if this is possible? Basically, I want to put the category / forum / post subject in the ubbt_registered.tmpl, but only do the queries if the pages are postlist or showflat...

Does that sound doable?

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I'm not clear on what you want to do. Could you provide an example, or examples, of what you want to display?

joeuser #260588 10/14/2003 10:25 PM
Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Yeah, I want the $CatName and $Title variables to display in the ubbt_registered menu bar basically....

I know I need to put a query in the template of ubbt_reg, something like this found in postlist....
Code
<br />// -------------------<br />// Grab the board info<br />   $Board_q = addslashes($Board);<br />   $query = "<br />      SELECT Bo_Title,Bo_CatName<br />      FROM   {$config['tbprefix']}Boards<br />      WHERE  Bo_Keyword = '$Board_q'<br />      $groupquery<br />   ";<br />   $sth = $dbh -> do_query($query);<br />   $rows = $dbh -> fetch_array($sth);<br />   list($Title,$CatName) = $rows;<br />   $dbh -> finish_sth($rows);<br />   if (!$Title) {<br />      $html -> not_right($ubbt_lang['BAD_GROUP'],$Cat);<br />   }<br />



So, basically, I need that query to be in the template, but only run if the page is postlist or showflat... Maybe there is a simpler way...

The point is that is that I'm building a menu and will have the Site Name : Forum Name : Post Title in the menu, where appropriate. Hope that made sense...

-peter

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
You should place your query code in the postlist/showflat php files and use an if statement to see if the use is registered/logged in before doing the queries:

if ($user['U_Number'] > 1) {
// do query
}


Store the results in a variable and display the variable in your ubbt_registered.tmpl file.

Sponsored Links
Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Dave -

I added the following code below the similar query in postlist....
Code
<br />if ($user['U_Number'] > 1) {<br />// -------------------<br />// Grab the board info   <br />$Board_q = addslashes($Board);   <br />       $query = "      <br />    SELECT<br />         Bo_Title,Bo_CatName      <br />       FROM   {$config['tbprefix']}Boards      <br />       WHERE  Bo_Keyword = '$Board_q'      <br />           $groupquery   ";   <br />           $sth = $dbh -> do_query($query);   <br />           $rows = $dbh -> fetch_array($sth);   <br />           list($TitleMenu,$CatNameMenu) = $rows;   <br />             $dbh -> finish_sth($rows);  <br />          if (!$TitleMenu) {      <br />            $html -> not_right($ubbt_lang['BAD_GROUP'],$Cat);   }<br />                        }<br />




And then added $CatNameMenu and $TitleMenu to the ubbt_registered.tmpl, but it's still not showing.... ? Did I do something wrong or misinterpret your instructions?

thanks for working with me!

-peter

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Any errors? Perhaps the query isn't returning any results?

You could place this in to see:

echo "$TitleMenu,$CatNameMenu"; exit;


right after

$dbh -> finish_sth($rows);


and see if there are any results.

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Yep, that spits out two correct results.

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
This is totally weird. I actually followed what you had me do, but it just doesn't show anything...No errors either..


Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
It's probably because the variables need to be made global or need to be pulled into the function sending the ubbt_registered template.

Sponsored Links
Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Can you give me an idea how to do that please?


Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
in the main include script set the variables at the begining of the script. Then in the send_header function add the variables to the 'global' call. Then they should be available in the ubbt_registerednav template.

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Works great! Thank you!

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Whoa! I tinkered with adding a couple things.... Is there any danger in adding some more variables to this? Like anything I should know?

-peter

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Dave - or anyone - another question -


Do you know how I can add the "post" link from postlist to the global variables.... I added $newpoststart and $newpoststop to the send header function, but it's not working... I did get the reply link to do this from showflat in the nav menu though...so it's gotta be possible..


-peter

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Okay, so in postlist, here's where the whole newpoststart and newpoststop stuff are defined....

Code
 // --------------------------------------------------------------------- <br />// We need to check and see if they have write privileges for this forum <br />   $gsize = sizeof($Grouparray); <br />   for ($i=0; $i <$gsize; $i++) { <br />      if (strstr($CanWrite,"-$Grouparray[$i]-") ) { <br />         $makepost = "yes"; <br />         break; <br />      } <br />   } <br />   if ($makepost == "yes") { <br />      $newpoststart = "<a href=\"{$config['phpurl']}/newpost.php..;sb=$sb&amp;o=$o\">"; <br />      $postoption = "newpost.gif"; <br />      $newpoststop = "</a>"; <br />   } <br />   else { <br />      $postoption = "greynewpost.gif"; <br />   } 


Does anyone know what all I need to put in the global header call to get that bit to work? The goal again, is to make a link that shows in the header for posting...

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Just in case it's not clear what I'm doing, if you can, check out my test board:

test board

Guest users will still see what I'm trying to do... When you click a forum, the ideal thing is that that post link will work, just like if you go into a thread the reply link does...

-peter

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
Does anyone, anyone at all know how to do this?

All I want to do is have the post link, from postlist.php work from the header in ubb_registered/ubb_unregistered.tmpl's.


-peter

Joined: May 2002
Posts: 362
Junior Member
Junior Member
Offline
Joined: May 2002
Posts: 362
WOOHOO! trial and error baby!! I gots it!



Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)