Previous Thread
Next Thread
Print Thread
Rate Thread
An if statement... #260585 10/14/2003 12:33 AM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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
Re: An if statement... [Re: adrienne48] #260586 10/14/2003 9:01 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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?

Re: An if statement... [Re: adrienne48] #260587 10/14/2003 9:09 PM
Joined: Apr 2002
Posts: 1,768
Dave_L_dup1 Offline
Addict
Offline
Addict
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?

Re: An if statement... [Re: joeuser] #260588 10/14/2003 9:25 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260589 10/14/2003 9:26 PM
Joined: Jun 2001
Posts: 3,273
JustDave Offline
That 70's Guy
Offline
That 70's Guy
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
Re: An if statement... [Re: sjsaunders] #260590 10/14/2003 9:37 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260591 10/14/2003 10:59 PM
Joined: Jun 2001
Posts: 3,273
JustDave Offline
That 70's Guy
Offline
That 70's Guy
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.

Re: An if statement... [Re: sjsaunders] #260592 10/14/2003 11:04 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
Joined: May 2002
Posts: 362
Yep, that spits out two correct results.

Re: An if statement... [Re: adrienne48] #260593 10/14/2003 11:27 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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..


Re: An if statement... [Re: adrienne48] #260594 10/15/2003 7:27 AM
Joined: Jun 2001
Posts: 3,273
JustDave Offline
That 70's Guy
Offline
That 70's Guy
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
Re: An if statement... [Re: sjsaunders] #260595 10/15/2003 12:06 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
Joined: May 2002
Posts: 362
Can you give me an idea how to do that please?


Re: An if statement... [Re: adrienne48] #260596 10/16/2003 9:00 PM
Joined: Jun 2001
Posts: 3,273
JustDave Offline
That 70's Guy
Offline
That 70's Guy
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.

Re: An if statement... [Re: sjsaunders] #260597 10/16/2003 9:41 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
Joined: May 2002
Posts: 362
Works great! Thank you!

Re: An if statement... [Re: adrienne48] #260598 10/16/2003 10:43 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260599 10/17/2003 12:54 AM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260600 10/19/2003 1:25 AM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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...

Re: An if statement... [Re: adrienne48] #260601 10/20/2003 12:12 AM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260602 10/25/2003 11:44 PM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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

Re: An if statement... [Re: adrienne48] #260603 10/26/2003 12:06 AM
Joined: May 2002
Posts: 362
Allusivekudos Offline OP
Junior Member
OP Offline
Junior Member
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
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,795
Joined: January 2000
Forum Statistics
Forums63
Topics37,528
Posts293,719
Members13,834
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online 115
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 27
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,795
Greg Hard 4,625
Top Posters(30 Days)
isaac 4
Gizmo 1
Top Likes Received
isaac 30
Gizmo 8
Brett 7
Morgan 2
Top Likes Received (30 Days)
Gizmo 8
isaac 1
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2020 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Snapshot build 20200126.dev)
Responsive Width:

PHP: 5.4.45 Page Time: 0.074s Queries: 53 (0.030s) Memory: 3.3919 MB (Peak: 3.6477 MB) Data Comp: Zlib Server Time: 2020-01-27 16:54:27 UTC
Valid HTML 5 and Valid CSS