View Full Version : [RESOLVED] Where are the header and headinclude templates rendered?
nerbert
10-06-2013, 06:21 AM
I'm considering a project that will require modifications to the head and headinclude templates but I don't want to give instructions for editing them, instead I want to create header_alt and headinclude_alt templates and have them rendered instead of the usual ones. This way the product can be turned off and the code will just go back to using the usual templates. I'm hoping there's a hook available where I can change the template rendered for the product.
Or is there a better way of going about this?
WEBDosser
10-06-2013, 06:30 AM
create a new style and edit those templates
nerbert
10-06-2013, 06:36 AM
I need these changes for all styles. And I won't be able to "force" users to switch from one style to another (or maybe I can but it's just not an acceptable way). My project (if it ever comes to fruition) is a secure login and that requires changes to the login form and several new JS files.
cellarius
10-06-2013, 06:55 AM
This will likely require file edits. Use Andreas' Template Modification System (TMS) instead.
nerbert
10-06-2013, 07:45 AM
I found it in includes/class_bootstrap.php, public function process_templates(). There's a hook on line 561, "process_templates_complete", where I can do something like this:
if($argle == 'bargle')
{
$templater = vB_Template::create('header_alt');
$templater->register('ad_location', $ad_location);
$templater->register('pmbox', $pmbox);
$templater->register('notifications_menubits', $notifications_menubits);
$templater->register('notifications_total', $notifications_total);
$templater->register('notices', $notices);
$templater->register('facebook_header', $facebook_header);
$header = $templater->render();
}
ozzy47
10-06-2013, 08:08 AM
What about the hook, template_render_output
if ($this->template == 'header')
{
$this->template = 'header_alt';
}
if ($this->template == 'headinclude')
{
$this->template = 'headinclude_alt';
}
nerbert
10-06-2013, 08:23 AM
Looks like that will work. I'm just planning this now so it will be a while before I test it. Thanks.
ozzy47
10-06-2013, 08:25 AM
No problem, I have used that hook in a few mods, and it seem to function just fine. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.