PDA

View Full Version : Dynamically Replace {vb:raw navbar}


Sadikb
03-03-2011, 06:56 PM
Hi,

What I want to do is dynamically replace certain default vb:raw variables from all templates. That is for example wherever {vb:raw footer} is present, I want to replace with {vb:raw navbar}{vb:raw footer}

I first thought this would be simple with replacement variables, but replacement is not working. So I figured I could probably intercept when the template is queried from the database and before it's parsed and put in the template cache. So far i haven't got around to figuring it out so any suggestion, directions would be much appreciated. I don't mind editing the php files directly if required.

Thanks

--------------- Added 1299213676 at 1299213676 ---------------

OK , temporarily solved this by modifying the return value of fetch_template. For anyone interested,

in file class_core.php, find the function definition,

protected static function fetch_template($template_name)

The return statement of this function is,

return $template;

I just modified the return value as

$template = str_replace('$footer', '$navbar.$footer', $template);
return $template;

This is just stop gap, until I find a better solution and strictly not recommended for newbies.