The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Using $vbulletin or $db in non-vb powered php file?
Hello,
This post seems to have grown. I wanted to explain exactly what I was doing so that someone might point me in the right direction. I've made a custom template inside which I want to output from a PHP file. This customTemplate is itself used inside the header template. The plugin for this customTemplate looks like: (hook: parse_templates) Code:
$templater = vB_Template::create('customTemplate'); $templatevalues['customTemplate_show'] = $templater->render(); vB_Template::preRegister('header', $templatevalues); (hook: parse_templates) Code:
ob_start(); include("http://www.myforum.com/myPHPfile.php"); $contents = ob_get_contents(); ob_end_clean(); $preRegister['phpFile_output'] = $contents; vB_Template::preRegister('customTemplate', $preRegister); The PHP file is simply: Code:
<?php echo("hello world"); ?> My problem starts when I want to start using vB specific globals in myPHPFile.php like $vbulletin or $db. I get a: Fatal error: Call to a member function query_read() on a non-object in /home/xxxx/public_html/myPHPFile.php on line 9 where line 9 is: Code:
$result = $db->query_read("Select * from ".TABLE_PREFIX."myTable"); 1. require_once("./global.php"); <--- this starts an infinite loop, and eventually crashes the browser 2. global $vbulletin 3. global $db I'd like to point out that, thanks to articles posted here, I have been able to use $vbulletin and $db in a regular vb powered custom page without any issues. Any help appreciated. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|