Ask the php array to display related issues cyclically on the Smarty template page.

Source: Internet
Author: User
Ask the php array to display the problem cyclically on the Smarty Template page $ row2 = explode ('______', $ conne-& gt; getRowsArray ($ SQL); $ smarty-& gt; assign (array (& quot; array3 & quot; = & gt; $ row, & ask the php array to be displayed cyclically on the Smarty template page
$ Row2 = explode ('______', $ conne-> getRowsArray ($ SQL ));
$ Smarty-> assign (array ("array3" => $ row, "array4" => $ row2 ));

Array defined here
{% Foreach item = I from = $ array3 %}
{% Foreach item = j from = $ array4 %} // here the loop array starts. in this way, how can we loop through the array content.
{% If $ I! = "Guid" %}

{% $ I | replace: "_": "" %}

(Chinese) (ENGLISH)


{%/If %}
{%/Foreach %}
{%/Foreach %}

------ Solution --------------------
Discussion
{% Foreach item = j from = $ array %} // here the loop array starts. in this way, how can we loop through the array content.

------ Solution --------------------
It indicates that your current $ j is a string, so you need to {% $ j % }.
------ Solution --------------------
Discussion

The value cannot be read. all output values are uppercase A {% $ j [0] %}

------ Solution --------------------
You can now echo on the php page'
'; Print_r ($ array); exit; check the structure and call it in smarty according to the structure. if you want to send the echo result, I will help you.
------ Solution --------------------
Haha, $ j is the string Array.
------ Solution --------------------
You can call
{% $ J [0]. guid %}. In other cases, you need to study more and practice more, so that you can easily find the rule.
------ Solution --------------------
The above is incorrect.
Yes {% $ j. guid %}

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.