vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   [RESOLVED] Where are the header and headinclude templates rendered? (https://vborg.vbsupport.ru/showthread.php?t=303021)

nerbert 10-06-2013 06:21 AM

[RESOLVED] Where are the header and headinclude templates rendered?
 
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:

Code:

        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

Code:

 
            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. :)


All times are GMT. The time now is 08:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01140 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete