Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smarty: unset an array index in template

I would like to do {unset($array['index'])} into a Smarty 3 template.

Is such a syntax (or similar) supported ? After Googling and doc reading I can't find something satisfying.

Maybe I should ask for a feature request to Smarty dev team ? :)

Anyway, how would you do this given the currently available template functions ?

like image 456
Frosty Z Avatar asked Dec 13 '22 09:12

Frosty Z


1 Answers

I don't think there's a direct support for this in smarty. You can always do this with smarty's {php} tag, however I would strongly discourage you from doing so. Logic doesn't belong in a presentation-level template.

like image 161
Aleks G Avatar answered Dec 23 '22 23:12

Aleks G