87,902
社区成员
发帖
与我相关
我的任务
分享
<?php
/*********************************************
*
* 文件名: example6.php
* 作 用: 显示实例程序2
*
* 作 者: 大师兄
* Email: teacherli@163.com
* 修 正: forest
*********************************************/
include_once("./comm/Smarty.class.php");
$smarty = new Smarty();
$smarty->templates("./templates");
$smarty->templates_c("./templates_c");
$smarty->cache("./cache");
$smarty->cache_lifetime = 0;
$smarty->caching = true;
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$array[] = array("newsID"=>1, "newsTitle"=>"第1条新闻");
$array[] = array("newsID"=>2, "newsTitle"=>"第2条新闻");
$array[] = array("newsID"=>3, "newsTitle"=>"第3条新闻");
$array[] = array("newsID"=>4, "newsTitle"=>"第4条新闻");
$array[] = array("newsID"=>5, "newsTitle"=>"第5条新闻");
$array[] = array("newsID"=>6, "newsTitle"=>"第6条新闻");
$smarty->assign("newsArray", $array);
//编译并显示位于./templates下的index.tpl模板
$smarty->display("example6.tpl");
?>
<html>
<head><title>这是一个foreach使用的例子</title></head>
<body>
这里将输出一个数组:<br>
<{section name=loop loop=$News}>
新闻编号:<{$News[loop].newsID}><br>
新闻标题:<{$News[loop].newsTitle}><br><hr>
<{sectionelse}>
对不起,没有任何新闻输入!
<{/section}>
</body>
</html>
<html>
<div style="position:absolute;top:expression(offsetParent.scrollTop)">
<button>按钮</button>或者表格图片等等乱七八糟的随便放!
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</html>
<html>
<head>
</head>
<body style="background-image: url('aa');background-attachment: fixed">
<div style="position:absolute;top:expression(offsetParent.scrollTop)">
<button>按钮</button>或者表格图片等等乱七八糟的随便放!
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>