The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Hook to header or headinclude
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: Code:
$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! |
#2
|
||||
|
||||
anybody?
|
#3
|
||||
|
||||
I would create a simple plugin and using hooks in the template:
Hook Location: Parse Templates PHP Code:
|
#4
|
||||
|
||||
I don't see a template called headinclude_javascript in the style manager, so can you help me understand what it is? Should it be headinclude instead?
Or, if that is correct, I didn't see a headinclude_javascript hook in the php code. All I saw was the parse_templates hook. Where did the headinclude_javascript come from? --------------- Added [DATE]1275868704[/DATE] at [TIME]1275868704[/TIME] --------------- Thank you DragonBlade, I got this to work by using headinclude_javascript. I'm not too sure how I would know that the template hook exists as that name, but it definitely works! Can you help me understand how you chose headinclude_javascript? I need to do another hook into the newthread template, and am equally as lost. I want to add a new field, so I think it would be at newthread_form_start, but I tried a similar hook to what you suggested for my headinclude but I'm having no luck. Once I get the new field added, I'm going to need to hook into the submit button too so I can process the results when the thread is created. I hate to be dependent on someone every time if I could learn how to do it on my own! Thanks man |
#5
|
||||
|
||||
The hooks are within the templates
For example, headinclude_javascript is within headinclude template. And the hook looks like this: {vb:raw template_hook.headinclude_javascript} |
#6
|
||||
|
||||
oooooh. I thought those were calls, not declares. Thanks, this should help!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|