The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Parse PHP in a Template
I have recently upgraded to VB3, my old boards had a banner rotator.php that was included in my header template.
My Problem: When I do a PHP include like so <? include ("rotator.php");?> it displays the text on the screen. It doesn't actually parse the code and randomly rotate my banners. Is there a command to force the template to parse the php code? |
#2
|
||||
|
||||
You can only parse PHP code in the phpinclude_start and phpinclude_end templates.
|
#3
|
|||
|
|||
Do you indcate it to be parsed by a PHP command or what?
|
#4
|
||||
|
||||
You just place your PHP in the template as if it was a .php file.
PHP Code:
|
#5
|
|||
|
|||
Thanks NTLDR... That worked, but now I have a second question. While reading the help screen for phpinclude_start.... It says You can enter PHP code here. The phpinclude_start template is evaluated at the beginning of page execution and can be used for putting things into templates.
So it sounds like I can now include the phpinclude_start to any template and it can be be displayed accordingly. My questions is, what is the syntax for inserting to a template, should I say include or drop it in as a variable in the template. Anna PS... Let me apologize in advance for dumb questions, my technical skills are green at best. |
#6
|
||||
|
||||
If you follow the example in there:
PHP Code:
|
#7
|
||||
|
||||
I have a similar problem, but I'm having some difficulty.
The problem is, I'm trying to get a php script that makes it's own call to a different database on the same server, called "center". The phpinclude_start statement looks like this: Code:
ob_start(); require_once ('../center/activity.php'); $activity1 = ob_get_contents(); ob_end_clean(); I tried using chdir("$/var/www/html/forums"); After the above include, but that did nothing. Anyone have any ideas? I'm sure I'm doing something wrong here. I tried using "include" and "require" above as well. |
#8
|
||||
|
||||
Whats the code in center.php? If it doesn't echo/print etc anything directly out then you just need the require_once() part in the php_include_start template.
|
#9
|
||||
|
||||
It does echo/print stuff out, which is the problem.
I finally solved this by moving the table it uses over to the vbulletin database, and using it instead. It's a small, simple table with 3 rows and not a lot of information, so load isn't an issue, and it works now. Kind of in-elegant for other types of php scripts though, but what can you do. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|