Colon : in array key

351 views
Skip to first unread message

Round Porch

unread,
Jan 9, 2009, 12:39:33 PM1/9/09
to Smarty Discussion
Hello,

I'm wondering if there is a way/workaround to get array keys with a :
in them to display on a template

$test = array(
'content:encoding' => 'utf-8',
'somethingelse' => 'test'
);

$smarty->assign('test', $test);
$smarty->display('test.tpl');

In the template I have

{$test['content:encoding']}

That and {$test.content:encoding} throw the same error Fatal error:
Smarty error: [in test.tpl line 5]: syntax error: unrecognized tag:
$test['content:encoding'] (Smarty_Compiler.class.php, line 446) in /
usr/share/php/smarty/libs/Smarty.class.php on line 1092

This is 2.6.19

Thanks,
Dustin

Monte Ohrt

unread,
Jan 9, 2009, 12:48:03 PM1/9/09
to smarty-d...@googlegroups.com
Similar problem (and approaches) discussed here:

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=4658
Reply all
Reply to author
Forward
0 new messages