Section loops are not available in Smarty

Source: Internet
Author: User
Smarty PHP html

Code in PHP:

Include ("global.php");

$name []=array ("Name" = "News");
$name []=array ("Name" = "News 2");
$title = "php100";
$smarty->assign ("title", $title);
$smarty->assign ("name", $name);
$smarty->display ("index.htm");

?>
HTM in code

{$title}

{Section name=list,loop= $name}

{$name [List].name}
{/SECTIOM}



If only the reference title can be called Normally, the loop will error
Error message:
Fatal error:uncaught-Smarty compiler:syntax Error in template ". \templates\index.htm" on line 4 "{Section Name=li st,loop= $name} "Missing" loop "attribute <--thrown in D:\wamp\www\class\smarty\sysplugins\smarty_internal_ templatecompilerbase.php on line 4


Reply to discussion (solution)

{section name=sn loop= $news}


The middle is a space, not a comma

{section name=sn loop= $news}


The middle is a space, not a comma
{section name=list loop= $name}

Useless, then {section name=list loop= $name}
{$name [List].name}
{/sectiom} three lines below are yellow wavy

{Section name=list,loop= $name} {$name [List].name} {/section}

section, you spelled it wrong, not sectiom.

{section name=list loop= $name} {$name [List].name} {/section}

It's supposed to be.

The pit daddy has the wood to have ~ ~

Thank you

  • 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.