View Full Version : IF Condition for this?
MarkFoster
09-19-2010, 05:00 AM
I am trying to display something on specific pages only. Is there an IF like this?:
Example only:
<if condition="url == http://example.com/example1.php"></if>
BigJohnny
09-19-2010, 11:16 AM
depending on where you put it you might want to try <IF THIS_SCRIPT == "index">
that will show whatever the code is on the index only.
MarkFoster
09-19-2010, 11:48 AM
depending on where you put it you might want to try <IF THIS_SCRIPT == "index">
that will show whatever the code is on the index only.
I went to put it on specific members' profiles.
There are ways to check the url - there's a $_SERVER variable that has that info in various forms. Here's a reference: http://php.net/manual/en/reserved.variables.server.php (maybe $_SERVER['PHP_SELF'] is what you're talking about).
However, it sounds like what you want is to check the user id, like
<if condition="$bbuserinfo['userid']==X">
if you want to put something in a template that's also included in other pages you could do like BigJohnny said,
<if condition="THIS_SCRIPT=='member' AND $bbuserinfo['userid']==X">
and if you also want to show it for a page that has a "do=" on the URL (but only for certain values), there's a way to do that, too.
<if condition="$_REQUEST['do'] == 'something'>
MarkFoster
09-20-2010, 07:51 AM
There are ways to check the url - there's a $_SERVER variable that has that info in various forms. Here's a reference: http://php.net/manual/en/reserved.variables.server.php (maybe $_SERVER['PHP_SELF'] is what you're talking about).
However, it sounds like what you want is to check the user id, like
<if condition="$bbuserinfo['userid']==X">
if you want to put something in a template that's also included in other pages you could do like BigJohnny said,
<if condition="THIS_SCRIPT=='member' AND $bbuserinfo['userid']==X">
and if you also want to show it for a page that has a "do=" on the URL (but only for certain values), there's a way to do that, too.
<if condition="$_REQUEST['do'] == 'something'>
About what I marked in bold, user profiles do not have any "do="'s but they do have "?u=". Any way the IF could be changed for that?
Also, I want this displayed on specific user profiles. However, I want it seen by every member. That's the reason why I need an IF. I intend to place it right under the username on certain profiles, like user ID 1, 5 and 7, yet seen by everybody.
Oh, I see now - my mistake. I think you want:
<if condition="$userinfo['userid'] == X">
You can ignore the other stuff (you had asked about checking the url I so was trying to cover all bases).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.