Ask the PHP array to cycle through the Smarty template page for questions

Source: Internet
Author: User
Ask the PHP array to cycle through the Smarty template page.
$row 2=explode (' ___ ', $conne->getrowsarray ($sql));
$smarty->assign (Array ("Array3" + $row, "array4" = $row 2));

The array is defined here
{%foreach item=i from= $array 3%}
{%foreach item=j from= $array 4%}//here to start the loop array, in such a way how to loop the contents of the array.
{%if $i! = "GUID"%}

{% $i |replace: "__": "%}

Chinese (中文版)


{%/if%}
{%/foreach%}
{%/foreach%}

------Solution--------------------
discuss
{%foreach item=j from= $array%}//here to start the loop array, in such a way how to loop the contents of the array.

------Solution--------------------
That means that your current $j is a string, so you have to {% $J%} on the line.
------Solution--------------------
discuss

The value is not read, the output is all uppercase a {% $j [0]%}

------Solution--------------------
You can now have the PHP page Echo '
';p rint_r ($array); exit; look at the structure inside, call it in Smarty according to the structure, or you can send out the results of ECHO, I'll take a look at it.
------Solution--------------------
Haha, this looks at $j is the string array chant
------Solution--------------------
You can call this
{% $j [0].guid%} So, the rest of the same, to more research now, to practice more, it is easy to find the law
------Solution--------------------
That's wrong.
is {% $j. Guid%}
  • Related Article

    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.