How does smarty assign a value to this layout? Thanks. This post was last edited by u011682370 from 2013-09-2313: 36: 24 & lt; div & nbsp; & gt; & lt; div & nbsp; & gt; & lt; img & nbsp; src & nbsp; & gt; & lt; div & g smarty how to assign a value to this layout? thank you!
This post was last edited by u011682370 at 13:36:24
How do I assign values to a large image like this, and then four small images, four small images, and one large image?
Smarty layout php
Share:
------ Solution --------------------
Reference:
If your loop array is:
$ Data = array (
0 => array ('Big '=> array ('src' => '... ',...), 'Small' => array ('src' => '... ',...)),
1 => array ('Big '=> array ('src' => '... ',...), 'Small' => array ('src' => '... ',...)),
);
The front-end page code can be written as follows:
<{Foreach from = $ data item = it key = ke}>
<{If $ smarty. foreach. item. iteration % 2 = 1}>
<{Foreach from = $ it. small item = s_it key = s_ke}>
"/>
<{/Foreach}>
"/>
<{Else}>
"/>
<{Foreach from = $ it. small item = s_it key = s_ke}>
"/>
<{/Foreach}>
<{/If}>
<{/Foreach}>
Note:
If $ smarty. foreach. item. iteration % 2 = 1
This condition is used to determine whether the integer of the current iteration to 2 is equal to 1. if yes, the layout of the four small charts will be displayed; otherwise, the layout of a large small graph will be displayed.
I don't know if my understanding is what you want to ask. I hope it will help you.
Correction: returns the remainder of 2.