If I try开发者_运维知识库 to assign a multidimensional array to a class i get this error
{Widgets->Widget
media='videos'
filters=Array('a' => 'b', 'c' => 'd')
}
"{assign var='X' value = Array('a' => 'b', 'c' => 'd')}" - Unexpected " => ", expected one of: "","" , ")"'
this doesn't work as well
filters['a']='b'
filters['c'] = 'd'
is there a way to circumvent this limit? the version of smarty I'm using is the latest.
the documentation isn't very clear about it: http://www.smarty.net/docs/en/advanced.features.objects.tpl
regards
I'm not sure if it is even possible to assign an array in smarty template. I did always circumvent this by instantiating an array in PHP code - then You can assign it to an object in PHP - and after that call $smarty->assign("object", $objectWithArray);
精彩评论