Galenorn
04-18-2013, 11:52 PM
I?m trying to set up the forums at my site and I need to include a few php files into the header, at the top of the vBulletin site, right after the <BODY> tag.
I?ve read https://vborg.vbsupport.ru/showthread.php?t=248309&highlight=include+php over and over, but it won?t register any variables.
Here is what I did:
I created a Plugin:
//#### Begin Plugin ####
ob_start();
// Included file is located one directory from the Forums, and in another directory
include("../AnotherDirectory/IncludeThisFile.php");
$includephp = ob_get_contents();
ob_end_clean();
// The 'header' template is where I want to output the files
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
I used a variety of hook locations. I?m positive it is correct.
For this, I used 'forumhome_start' and 'global_bootstrap_start', and I got the same results.
Then I went to the 'header' template, and at the top I added:
{vb:raw includephp}
However, when I run the forums, the additional PHP content doesn't appear.
So, I altered the Plugin:
//#### Begin Plugin ####
ob_start();
// Included file is invalid
include("../AnotherDirectory/InvalidFileDoesNotExist.php");
$includephp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
When I run the forums again, I get a PHP error message, saying file not found.
Therefore, I concluded that the first plugin code is fine.
So, I altered the Plugin to something simple:
//#### Begin Plugin ####
$includephp = ?<p>Hello</p>?;
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
When I run the forums again, additional content doesn't output.
I can?t find 'Hello' on the page.
So, now I edited the 'header' template, and entered at the top:
<p>Hello</p>
When I run the forums again, '<p>Hello</p>' is outputted on the top of the page before anything else is generated.
Therefore, I concluded that I need to register the variable in the hook.
Where do I register variables? Am I even doing it right?
I have been spending several days trying to get this to work, and nothing.
And yes, I explicidly followed the instructions on the forums, and nothing.
Samwise Galenorn
I?ve read https://vborg.vbsupport.ru/showthread.php?t=248309&highlight=include+php over and over, but it won?t register any variables.
Here is what I did:
I created a Plugin:
//#### Begin Plugin ####
ob_start();
// Included file is located one directory from the Forums, and in another directory
include("../AnotherDirectory/IncludeThisFile.php");
$includephp = ob_get_contents();
ob_end_clean();
// The 'header' template is where I want to output the files
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
I used a variety of hook locations. I?m positive it is correct.
For this, I used 'forumhome_start' and 'global_bootstrap_start', and I got the same results.
Then I went to the 'header' template, and at the top I added:
{vb:raw includephp}
However, when I run the forums, the additional PHP content doesn't appear.
So, I altered the Plugin:
//#### Begin Plugin ####
ob_start();
// Included file is invalid
include("../AnotherDirectory/InvalidFileDoesNotExist.php");
$includephp = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
When I run the forums again, I get a PHP error message, saying file not found.
Therefore, I concluded that the first plugin code is fine.
So, I altered the Plugin to something simple:
//#### Begin Plugin ####
$includephp = ?<p>Hello</p>?;
vB_Template::preRegister('header', array('includedphp ' => $includedphp));
//#### End Plugin ####
When I run the forums again, additional content doesn't output.
I can?t find 'Hello' on the page.
So, now I edited the 'header' template, and entered at the top:
<p>Hello</p>
When I run the forums again, '<p>Hello</p>' is outputted on the top of the page before anything else is generated.
Therefore, I concluded that I need to register the variable in the hook.
Where do I register variables? Am I even doing it right?
I have been spending several days trying to get this to work, and nothing.
And yes, I explicidly followed the instructions on the forums, and nothing.
Samwise Galenorn