vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Auto Template Change Help (https://vborg.vbsupport.ru/showthread.php?t=202089)

Voltar 01-17-2009 07:53 AM

Auto Template Change Help
 
So since upgrading to vB 3.8.0 I've been recoding all of my hacks and template modifications to use plugins and I've ran into a bit of an issue. One of the little things that I do is remove the version number from public display, which requires a phrase edit/translation and editing the generator meta tag in the headinclude template.

After reading This, This and This, and making progress on my other mods, I ran into a problem where I can't get a change to take place in the headinclude template, no matter what hook I try.

This is what I've been trying...
PHP Code:

$gen_find '<meta name="generator" content="vBulletin $vboptions[templateversion]" />';
$gen_replace '<meta name="generator" content="vBulletin" />';
$vbulletin->templatecache['headinclude'] = str_replace($gen_find$gen_replace$vbulletin->templatecache['headinclude']); 

I've also tried every combination of escaping and quoting that I can think of, and even using the the version number added in manually (with a hook after parse_templates), and even using $vbulletin->options['templateversion'] concatenated into the string. Any ideas?


Also, is there a simple/easy/proper way to directly concatenate two templates together?

Andreas 01-17-2009 08:33 AM

You should never-ever manipulate the tamplate cache.
Not only does this generate unnecessary overhead, it also causes a lot of problems for users who cache templates.

Use template hooks instead if possible, if not just instruct the users to modify the templates by hand.

Voltar 01-17-2009 10:29 AM

I know a few of the mods I currently have installed modify the template cache, and I was going from the articles. A few of the mods are solely for one of my boards, which I have several styles on, trying to make upgrading simpler.

So instead of modifying the template cache I should modify $headinclude, $header, $footer, etc if no hook exists?

Andreas 01-17-2009 01:22 PM

Yes, that would be a lot better (performance wise).


All times are GMT. The time now is 09:29 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.00982 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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