织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

织梦cms中PHP文件根据id输出指定代码文本

织梦园模板 / 2017-12-16 / 收藏
如题,实现的办法比较简单,一句JS搞定:document.getElementById("testx").innerHTML="<h2>222222222222222</h2>";  

然后我们在其关联的模板htm文件 写入 <div id='testx'></div>

再扩展下,便可得


document.getElementById("Comment").innerHTML="<?php
  $dsql->GetOne("select * from `archives` WHERE channel='3' order by id DESC limit 9");
  $dsql->Execute('me');
  while ($row = $dsql->GetArray('me')){
 if($row['flag'] == "c,p"){
  $tj = "<i class='tj'></i>";
 }else{
$tj = "";
 }
  ?><li><a href='../plus/view.php?aid=<?php echo $row['id']; ?>' target='_blank' title='<?php echo $row['title']; ?>'><img src='<?php echo $row['litpic']; ?>' width='230' /><?php echo $tj; ?></a><span class='title' title='<?php echo $row['title']; ?>'><a href='../plus/view.php?aid=<?php echo $row['id']; ?>' target='_blank'><?php echo $row['title']; ?></a></span></li><?php
  }  print_r($row);
  
  ?>";

可以方便在织梦会员中心调用出需要的循环文档

相关站长手记

收缩