首页 > php框架 > php smarty 模板section入门教程与实例

php smarty 模板section入门教程与实例

<?php
include ("smarty_inc.php");
include ("config.php");
$rzlysql = "SELECT * FROM `log_reply`";
$rzlyr = mysql_query($rzlysql, $conn);
while ($nam = mysql_fetch_array($rzlyr)) {
    $name[] = array(
        "id" => $nam["id"],
        "info" => $nam["info"],
        "ip" => $nam["ip"],
        "time" => $nam["time"],
        "Reply" => $nam["Reply"]
    );
}
$smarty->assign("title", $name);
$smarty->display("index.html");
?>

然后是 index,html

<body>
<{section name=y loop=$name}>
<{$title[y].id}> - <{$title[y].info}> - <{$title[y].ip}> - <{$title[y].time}> - <{$title[y].Reply}>
<{sectionelse}>
http://www.phprm.com
<{/section}>
</body>


文章地址:http://www.phprm.com/frame/33243.html

转载随意^^请带上本文地址!

标签:none

发表留言