The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP in vB4 template
Hey,
I want to include a php file which generates a list (/Forum/statsinner.php) at the bottom of a custom vbulletin page (/Forum/database5yr.php). To do this I have added an includephp plugin (in global start): Code:
ob_start();
include('/Forum/statsinner.php');
$includedphp = ob_get_contents();
ob_end_clean();
However - this doesn't seem to be working. Have I done something crazy here? This has really got me stumped, any help would be very much appreciated. |
#2
|
|||
|
|||
Quote:
|
#3
|
|||
|
|||
I think the problem we both have is that template/variables need to be pre-registered now whereas in the past they didn't.
But I can't for the life of me figure out where I'm going wrong. I've tried adding this (below) code into both my include PHP and my custom page PHP and still no luck: Code:
vB_Template::preRegister('cpage_Stats',array('includedphp ' => $includedphp)); |
#4
|
|||
|
|||
Got it! Let me know if this works for you.
Code:
ob_start();
include('/Forum/statsinner.php');
$includedphp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('TEMPLATE_NAME_YOU_ARE_ADDING_CALL_INTO', array('includedphp' => $includedphp));
My example: Code:
ob_start();
include("$_VhostPath/html/custom/vbulletin_display_login.php");
$pb_header_include = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('header', array('pb_header_include' => $pb_header_include));
Quote:
|
#5
|
|||
|
|||
Okay, When I got it working, it knocked one of my other custom pages off. The global hook has disabled one of my other custom template pages.
Heres the link and the error code: I'm not sure but I think maybe its not clearing the object buffering? As of 13:27 today this is still not working. It seems if I disable my plugin (in the above posts), the page linked above works. If it enable them, i get the error you can see. |
#6
|
|||
|
|||
Can you post your statsinner.php code? I'm thinking you are having some conflicts with your SQL queries?
|
#7
|
|||
|
|||
I think you may be right, heres my statsinner.php code:
PHP Code:
|
#8
|
|||
|
|||
* bump *
|
#9
|
|||
|
|||
* bump *
|
#10
|
|||
|
|||
I followed https://vborg.vbsupport.ru/showthread.php?t=228112 and it worked great. I created a new template called road4 and a new php file called road.php and it works great. Now I need to load up the contents of a php page I built that has lots of php code, db calls, javascript etc. I was thinking this was not going to work until i stumbled across this thread:
I can't seem to figure out exactly what you guys did to get this to work. So at this point I have the custom template based on the global style and I have the php page. So do I need to create another vbulletin PHP page and enter my php-javascript-html code on it? And where do I put {vb:raw includedphp} ? and where do I put vB_Template:reRegister('road4',array('includedphp ' => $includedphp)); ? If there are any kind souls who know how to do this I would really appreciate a post back. NickyDee, I checked out your site and confirmed this is exactly what i need. I;m confused about statsinner.php. In that file you have a bunch of Vbulletin entries in addition to your PHP code. How did you guys do this? Any help would be greatly appreciated. Kyle Kyle |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|