自动生成静态页面时不显示模板中循环出来的内容? 我在模板页中用smarty循环出来的数据库的内容,(直接浏览模板页,源代码中有数据库中的内容)但是查看自动生成的页面源代码中 却没有出现循环的那部分内容?有什么原因会导致这中情况呀???或者说还有什么方法可以使在数据库中的内容显示在自动生成的页面中(需要循环出来的) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我生成静态页面的代码;<?phpinclude('../config.ini.php');include('../common/smarty.php');include('../common/mysql.php');$editor=new Editor;$content=$editor->show('content','');if(isset($_POST['action']) && $_POST['action']=='add'){ $title=$_POST['title']; $content=$_POST['content']; $author=$_POST['author']; $time=$_POST['year'].'-'.$_POST['month'].'-'.$_POST['days']; $sql="insert into `article`(title,content,author,addtime,hits) values ('$title','$content','$author','$time','0')"; $res=$db->exec($sql); $id=$db->lastInsertId(); $sqls="select * from `article` where `id`=".$id; $ress=$db->getRow($sqls); $tpl->assign('res',$ress); if(!file_exists($ROOT.'/html')){ mkdir($ROOT.'/html'); } $open=fopen($ROOT.'/html/article-'.$id.'.html','w'); $content=$tpl->fetch($ROOT.'/content.html'); fwrite($open,$content); echo "<script>alert('发表成功!');location.href='article.php';</script>";}$tpl->assign('content',$content);$tpl->display('admin/article.html');?>这是要在模板中循环的内容 content.html是模板页if(isset($_POST['action']) && $_POST['action']=='add'){ $tit=$_POST['tit']; $sql="insert into `slselina` (tit) values ('$tit')"; $res=$db->getRow($sql); $sesql="select * from `slselina` order by id desc limit 5"; $seres=$db->getAll($sesql);}$tpl->assign('tits',$seres);$tpl->fetch($ROOT.'/content.html');$tpl->display('admin/slselina.html');请指点 你既然用smarty 那么在后台先取出数据库的数组后,在用foreach循环输出 到html页html绑定不就可以了么 $tpl->assign('name', $数据库数组);html 页面{$name } php_mysqli.dll的问题 mysql PHP语句,$map['sex'] = "男“ 或者等于女怎么写 哪位高人用php处理过音频文件?比如判断播放时间等? 有没有人要找工作的,PHP全职 急,修改完mysql登陆密码后,无法进入phpmyadmin. 遇到一个php版本的问题 大家看看这台主机(phpinfo)如何, 好象没装zend decoder 关于require、include方法的设置 有关php的下载的问题 求PHP绑定域名代码,比如绑定www.baidu.com,若非此域名打开时则提示“域名非法” phpmyadmin无法登录
include('../config.ini.php');
include('../common/smarty.php');
include('../common/mysql.php');
$editor=new Editor;
$content=$editor->show('content','');
if(isset($_POST['action']) && $_POST['action']=='add'){
$title=$_POST['title'];
$content=$_POST['content'];
$author=$_POST['author'];
$time=$_POST['year'].'-'.$_POST['month'].'-'.$_POST['days'];
$sql="insert into `article`(title,content,author,addtime,hits) values ('$title','$content','$author','$time','0')";
$res=$db->exec($sql);
$id=$db->lastInsertId();
$sqls="select * from `article` where `id`=".$id;
$ress=$db->getRow($sqls);
$tpl->assign('res',$ress);
if(!file_exists($ROOT.'/html')){
mkdir($ROOT.'/html');
}
$open=fopen($ROOT.'/html/article-'.$id.'.html','w');
$content=$tpl->fetch($ROOT.'/content.html');
fwrite($open,$content);
echo "<script>alert('发表成功!');location.href='article.php';</script>";
}
$tpl->assign('content',$content);
$tpl->display('admin/article.html');
?>这是要在模板中循环的内容 content.html是模板页if(isset($_POST['action']) && $_POST['action']=='add'){
$tit=$_POST['tit'];
$sql="insert into `slselina` (tit) values ('$tit')";
$res=$db->getRow($sql);
$sesql="select * from `slselina` order by id desc limit 5";
$seres=$db->getAll($sesql);
}
$tpl->assign('tits',$seres);
$tpl->fetch($ROOT.'/content.html');
$tpl->display('admin/slselina.html');
请指点
你既然用smarty
那么在后台先取出数据库的数组后,在用foreach循环输出 到html页
html绑定不就可以了么
html 页面{$name }