To modify a template I've used:
Code:
//Store the existing template and create our new one
$old_template=$this->Template;
$this->strTemplate = 'new_template; //NEEDS ADDITIONAL WORK to read from DB (if required)
$this->Template = new Template($this->strTemplate);
// Get the existing template information and assign to our new template
$t_array = (array)($old_template);
$val=chr(0).chr(42).chr(0).chr(97).chr(114).chr(114).chr(68).chr(97).chr(116).chr(97);
foreach($t_array[$val] as $key=>$val)
$this->Template->$key=$val;
I need to investigate this a bit further since I'm not exactly happy with the character hack but this does work without touching any core files.
A side note, I would suggest all devs to NEVER modify core files. It's hell to reverse, there are plenty of methods around having to modify core files.
Bookmarks