How does smarty assign values to this layout? thank you!

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.