encryption
05-23-2010, 09:52 PM
Hey guys, hopefully someone can help me here. I have searched all over vbulletin.org, .com, and Google for 3-4 hours now and can't find an answer to what should be a simple question for my first plugin experience!
I want to add some custom data to the headinclude template, and I'd like to do it via a plugin without actually editing the headinclude template. I downloaded the class_bootstrap.php include and see two different hooks: parse_templates, which seems to happen just before header processing, and process_templates_complete, which seems to happen just after processing and before rendering.
I see this code in the class_bootstrap.php include file:
$templater = vB_Template::create('headinclude');
$templater->register('foruminfo', $foruminfo);
$templater->register('pagenumber', $pagenumber);
$templater->register('style', $style);
$templater->register('basepath', VB_URL_BASE_PATH);
$headinclude = $templater->render();
Since $headinclude isn't touched anywhere else through the point of where process_templates_complete is called, I just assume I could add text directly to that variable from my plugin. I have tried all sorts of things to add my line of code, but from what I understand, this should work:
$headinclude = $headinclude . '<script src="djdb/ajax.js"></script>';
This line never appears anywhere in my page source. Can someone please help figure out how to insert this line into the header via a plugin? Or tell me what I'm doing wrong and how I can do a plugin correctly? Thanks!
I want to add some custom data to the headinclude template, and I'd like to do it via a plugin without actually editing the headinclude template. I downloaded the class_bootstrap.php include and see two different hooks: parse_templates, which seems to happen just before header processing, and process_templates_complete, which seems to happen just after processing and before rendering.
I see this code in the class_bootstrap.php include file:
$templater = vB_Template::create('headinclude');
$templater->register('foruminfo', $foruminfo);
$templater->register('pagenumber', $pagenumber);
$templater->register('style', $style);
$templater->register('basepath', VB_URL_BASE_PATH);
$headinclude = $templater->render();
Since $headinclude isn't touched anywhere else through the point of where process_templates_complete is called, I just assume I could add text directly to that variable from my plugin. I have tried all sorts of things to add my line of code, but from what I understand, this should work:
$headinclude = $headinclude . '<script src="djdb/ajax.js"></script>';
This line never appears anywhere in my page source. Can someone please help figure out how to insert this line into the header via a plugin? Or tell me what I'm doing wrong and how I can do a plugin correctly? Thanks!