PDA

View Full Version : Auto Template Change Help


Voltar
01-17-2009, 07:53 AM
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 (https://vborg.vbsupport.ru/showthread.php?t=151254), This (https://vborg.vbsupport.ru/showthread.php?t=151332) and This (https://vborg.vbsupport.ru/showthread.php?t=151288), 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...
$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).