Marcus
Well-known member
Can I add params to an existing template with template hook, without adding a template? This is not working, the variable test_variable is not given to the template navigation_visitor_tab.
This works, but only in the added template my_template:
Is it possible to just put a parameter into an existing template like navigation_visitor_tab?
Code:
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template) {
switch($hookName) {
case 'navigation_visitor_tab': {
$myParams = array('test_variable' => 1,);
$mergeparams = array_merge($myParams, $template->getParams());
$template->setParams($mergeparams);
break;
} }
This works, but only in the added template my_template:
Code:
case 'body':{
$myParams = array(test_var => 1);
$contents = $template->create('my_template', array_merge($myParams, $template->getParams())) . $contents;
break;
}
Is it possible to just put a parameter into an existing template like navigation_visitor_tab?