Assigning variables to ametemplate


#1

Hi there

I’m trying to assign values to variables in a smarty template.

I have, in my Controller class:

$view = Piwik_ViewDataTable::factory(‘graphVerticalBar’);
$view->init($this->pluginName, FUNCTION, ‘Labs.fn_name’);
$smarty = new Piwik_Smarty();
$tpl = ‘template.tpl’;
$smarty->assign(‘test_val’, ‘355866’);
$view->setTemplate($tpl);
$this->renderView($view);

and in template.tpl

In Google Chrome I’m getting:

Uncaught SyntaxError: Unexpected token ILLEGAL

pointing me to index.php line 562.

But

var_dump($smarty->get_template_vars());

shows the variable set correctly.

Any help would be much appreciated.

Thanks in advance for your time

David Robinson