PDA

View Full Version : Templatecache vB 3.8 to vB 4.0


RobDog888
05-25-2010, 09:17 PM
Im in the process of upgrading my custom plugins from vB 3.8 to 4.0 and the fetch_template doesnt exist anymore. Not a problem but replacing/modifying templates that are cached is now a problem. There are no hooks where I need them so this still has to be the way I have to do it. It works in 3.8

This is a simplified example of a plugin in parse_templates:
$find = '{vb:rawphrase all_times_are_gmt_x_time_now_is_y}';
$replace = ' Blah';
$vbulletin->templatecache['footer'] = str_replace($find, $find.$replace, $vbulletin->templatecache['footer']));

But for some reason the text isnt appending.

RobDog888
05-27-2010, 04:43 AM
Wow, a whole day and not a single response. This site really isnt what t used to be.
Ive been searching and reading and the examples dont work for me.

Zachery
05-27-2010, 07:01 AM
Do you want to elaborate how they are not working? Any reason you you can't just piggy back the phrase and add more information to it?

RobDog888
05-27-2010, 08:33 AM
Thanks for the reply.

It wasnt matching on the phrase like posted. Which template field should I be using to match upon? The "template" field or the "template_un" field as the phrase constant is in different format between the two? I tried both.

I got around it for now by matching some html instead but Im sure I cant rely upon that for the other plugins. Phrase replacement variables are better place markers.