MyBB Community Forums

Full Version: Plugins editing templates...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I make my Plugin edit a template? I looked on the Docs site and the guide there explained how to insert {$randomvar} into the template, but it never explained how to create {$randomvar} in the first place. Perhaps it's me being thick, it's 12:30AM here...
(2012-11-09, 11:24 AM)Seabody Wrote: [ -> ]but it never explained how to create {$randomvar}

function some_hook() // which runs before template is evaluated
{
    global $randomvar;

    $randomvar = "some stuff";
}
Example
function pluginname_activate()
{
 global $db;
	find_replace_templatesets("index", "#".preg_quote("{\$forums}")."#i", "{\$forums}\r\n {\$randomvar}");
}
Thank you frostschutz and teamnguyen949. Smile