UBB.Dev
Posted By: chuckee Basic conditional test - 05/20/2005 1:14 AM
Hi,
I have a pretty simple question but don't really know how to answer it. I want to display ads on my forum to non-members only, but am not sure of the correct conditional (if) statement to use here.
Cheers for the help!
Posted By: Anno Re: Basic conditional test - 05/20/2005 2:47 AM
if(!$user){
display ad
}

you have to place that after
$user = $userob -> authenticate......
Posted By: chuckee Re: Basic conditional test - 05/20/2005 3:18 AM
Thanks for that.
Am I correct in saying that there is no way to have *conditional code* in the 'header' HTML include available from the admin control panel?
In other words, if I want a different header for members and non-members then I should simply edit the ubbthreads.php file and replace the following line with my conditional code?
$html -> send_header($config['title'],$Cat,0,$user);

Also, I think this is probably a stupid question, but how do I actually get stuff to be output to the resulting file that is sent to users' browsers? Is it using the $html variable? If so, then how would I print 'Hello' only to non-members?
Posted By: Anno Re: Basic conditional test - 05/20/2005 5:38 PM
Actually you want to put it into the template file, not the php file itself.
Posted By: chuckee Re: Basic conditional test - 05/21/2005 12:26 AM
Cheers,
Is there any way that I can show a different header to members and non-members? I really don't want to have to edit every template file there is, as this will only cause problems down the track.

This is extremely important, as my current members would not put up with ads, but I have 10 times as many non-members as members, and need them to start seeing some advertisements.
Posted By: Anno Re: Basic conditional test - 05/21/2005 4:15 AM
>Is there any way that I can show a different header to members and non-members?

I don't know.

> I really don't want to have to edit every template file there is

There really are only a few relevant ones.

ubbthreads.tmpl
postlist.tmpl
showflat.tmpl
showthreaded.tmpl
Posted By: scroungr Re: Basic conditional test - 05/21/2005 7:52 AM
actually if you want to show a different header to users that say have $user[U_Number] and a nonmember who doesn't.. then throw the code in the ubbt.inc.php in the send_header function...I mean you can put conditional if's into it so that if a $user[U_Number] is detected this happens... and if not then this happens.. just expand the already present capabilites of it
© UBB.Developers