The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Include File in Template
I have a piece of code that is only suppose to run when the $denyadminip is put into a template. For some reason it is running everywhere on the forums. I know I set it to global, but it should only run when I put $denyadminip. Anyway here is the code:
Code:
<hookname>global_start</hookname> <phpcode><![CDATA[ob_start(); include('allowip.php'); $denyadminip = ob_get_contents(); ob_end_clean();]]></phpcode> |
#2
|
|||
|
|||
Plugins are always run depending on their hook location, changing what is in the template has no effect on a plugin. Change the hook location if you want to change when/where a plugin is execute.
$denyadminip is just the output and nothing else. |
#3
|
|||
|
|||
Is there a way to include a php file and then making it execute by putting $denyadminip in it?
|
#4
|
|||
|
|||
PHP Code:
|
#5
|
|||
|
|||
Thanks!
--------------- Added [DATE]1217393167[/DATE] at [TIME]1217393167[/TIME] --------------- Actually it is still executing the contents of allowip.php on all pages. So any other solutions? --------------- Added [DATE]1217393479[/DATE] at [TIME]1217393479[/TIME] --------------- Actually that code causes my profiles to not be able to be viewed. |
#6
|
|||
|
|||
Else you need to think up some kind of condition to enclose the include.
|
#7
|
|||
|
|||
What would be the condition to use if I wanted to use it on allowip.php?
|
#8
|
|||
|
|||
The way you have it set at global its going to execute everywhere. You could change the hook location to only where you want it to execute or You could check for certain $variables that are only defined in certain sections of the site before you execute it, such as $threadinfo when viewing threads...etc. Or you could check the THIS_SCRIPT constant against what the constant is defined as in the file you want it executed. Theres a million or more ways to accomplish it. It would be easier to help you if you gave information about where your trying to get it to execute. There is no way to just say hey if I put this variable in this template thats when you need to execute the code to fill the variable.
|
#9
|
|||
|
|||
I am trying to execute it in a file I made. It does have a THIS_SCRIPT, so how would I set it up to use this?
|
#10
|
||||
|
||||
If you are trying to execute that code in a custom file - why not put it into the file in the first place?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|