PDA

View Full Version : Plugin Variable Not Displaying


FireFeather
07-13-2011, 10:45 PM
I've been searching for a solution for this for several hours and I haven't been able to resolve my issue though I've implemented exactly as quite a few tutorials have shown.

I'm trying to include a PHP file (ultimately) in the header, but have simplified the process just to test the variables at this time.
I've created a new plug in with the follow fields set:

Product: vBulletin
Hook Location: global_start
Title: Include CC Site Banner/Menu
Execution Order: 1
Plugin PHP Code:
ob_start();
include(DIR.'/../library/header.php');
$includedphp = ob_get_contents();
ob_end_clean();
$includedphp = 'julie is testing the header';
vB_Template::preRegister('header',array('includedp hp ' => $includedphp));
Plugin is Active: Yes

In the "header" template, at the very top, I have added:
{vb:raw includedphp} testing

The location of this forum is at:
http://www.centercross.com/forum/
I can view the "testing" output that was put into the header template directly, but I cannot for the life of me get the "julie is testing the header" to appear before it.

Any suggestions anyone has would be greatly appreciated.

-Julie
Texas

--------------- Added 1310601479 at 1310601479 ---------------

Also, as a side note, the master plugin system is indeed turned on:
Enable Plugin/Hook System: Yes

kh99
07-13-2011, 10:59 PM
This line:

vB_Template:PreRegister('header',array('includedph p ' => $includedphp));

has a space after the first includephp (inside the quotes). I don't know if that's just a typo in the post or what.

FireFeather
07-13-2011, 11:03 PM
SOLVED
I have identified the issue. The code I copied from the documentation on including external files has an extra "space" character after the array key definition. Upon deleting that white space, it all worked fine.

Sorry for not noticing before I posted!

--------------- Added 1310601820 at 1310601820 ---------------

This line:

vB_Template:PreRegister('header',array('includedph p ' => $includedphp));

has a space after the first includephp (inside the quotes). I don't know if that's just a typo in the post or what.

Thank you KH99, I noticed this myself just minutes ago. Thank you for your input!