Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. This implies that PHP code is application logic, and is separated from the presentation. very useful in MVC architecture and used by many big cms and frameworks like Prestashop script.
so to create an array you can declare it like that
1 |
{$arr = [16,'value2','String3',20,22,23]} |
to print out smarty array value you can use the foreach loop
1 2 3 |
{foreach from=$arr item=val} {$val} <br /> {/foreach} |
the result will be
1 2 3 4 5 6 |
16 value2 String3 20 22 23 |
to search value on array you can use this condition
1 2 3 |
{if $queryvalue|in_array:$arr} {$queryvalue} exist in array {/if} |
hope you learn some of smarty with me,feel free to ask for anything about smarty on comments