The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
If statement based on page
I know vbulletin has if statements, which is all fine and dandy. But what about if you only want to run a bit of code based on the url of the page you are on. Is that possible?
e.g. if url contains forumsdisplay.php, then do such and such. Thanks, Jon |
#2
|
|||
|
|||
THIS_SCRIPT constant will give you the script name of the page you are on.
For example, forumdisplay.php value is forumdisplay. |
#3
|
|||
|
|||
Does it let you use variables too?
e.g. Code:
<if condition="THIS_SCRIPT == 'register.php?do=checkdate'"></if> |
#4
|
|||
|
|||
If you want variables refer to the do branch.
You can also do request uri: http://php.net/manual/en/reserved.variables.server.php But this may be more unreliable. |
#5
|
|||
|
|||
What do you mean by referring to the do branch? :S
Edit: I've just looked at 'Do' Branch Naming in the vbulletin manual but can't seem to understand how this can help me check for a specific url with a specific variable. |
#6
|
||||
|
||||
i can help you on this, but if you need private discussion/support for it, feel free to pm me with your code so i can teach you how to handle your data...
the if statement is not only adjustable in templates, but from the global calls as well... so if you want to change something from the register page, instead of calling a check/statement in the template as you seems to do right now, we can look at a more "php-like" verification for a better result. |
#7
|
|||
|
|||
That's kind of you vbenhancer. Actually, I think I am starting to understand this a little better, thanks to your guidance!
Lets take an example and perhaps someone can confirm if I have got this right or not. I am on mytemplate.php and I want to check for the value of a variable in the url. mytemplate.php?do=dog and mytemplate.php?do=cat Here is my code: Code:
if ($_POST['do'] == 'dog') { // Run my javascript } if ($_POST['do'] == 'cat') { // Run my javascript } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|