A
A
Alexey Tsarapkin2015-12-09 08:44:05
PHP
Alexey Tsarapkin, 2015-12-09 08:44:05

How to write in smarty?

How will the loop look like in the smarty template engine?

foreach ($array as $i => $var) {
echo $var . $i;
}

To make it even clearer - the string is not accepted
{$pg_index.z{$group.pg_id}}

PS I apologize for the stupidity, I did not work with smarty and I cannot formulate the question correctly in Google.
UPD:
Some more clarification
{foreach from=$groups item=group}
{$pg_index.z{$group.pg_id}}
{/foreach}

Exist
{$pg_index.z1}
{$pg_index.z2}
{$pg_index.z3}
{$pg_index.z4}

and so on
{$group.pg_id} just represents this figure

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2015-12-09
@maxpointn2point

<ul>
{foreach from=$myArray item=foo}
    <li>{$foo}</li>
{/foreach}
</ul>

link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question