smarty如何显示生成的静态页面

来源:百度知道 编辑:UC知道 时间:2024/06/18 06:15:35
网站采用php,使用模板smarty,现在使用生成静态页技术。生成函数如下:
function zhtm($url,$name){
extract($url);
extract($name);
$url="http://127.0.0.1/hgsm/".$url;
$content=file_get_contents($url);
if(file_exists($filename)) unlink($filename);
$filename="source/$name.htm";
$fp = fopen($filename, 'w+');
fwrite($fp, $content);
return $filename;
}

现在在现实中用循环显示数据库中数据如下:
<{section name=sec7 loop=$info7}>
<a href=""><{$info7[sec7].title}></a>

那么请问href中的链接怎么写啊,怎样才能连接到静态页呢。

哪位帮帮我了
怎么换,关键是

在数据库中你的表里面加个字段,把静态页的地址存上,这样
{section name=sec7 loop=$info7}
<a href="{$info7[sec7].url}"><{$info7[sec7].title}></a>
{/section}
就可以了,最后读的就是静态页的地址

smarty替换不知道吗?
$smarty->assign('info7',$data);
其中$data就是你查询数据库的结果,记住应该是二维数组

似乎回答过,其实就是换个链接,把原来的news.php?id=123换成123.html,有个带头的页面就是首页,后台会有刷新首页列表页和内容页的功能