3.7 应用举例 评论说说
说说的实现需要把newstext转化为主表,然后模型勾选列表页能够搜索。
列表内容模板(list.var) (*)
<section><i class="mood_tx"><img src="[!--news.url--]skin/html/images/yangqq.jpg" class="moodhead"></i><div class="moodtext">[!--newstext--]'.$titlepic.'</div><span class="moodtime">[!--newstime--]</span><span class="btnpl">评论(<script type="text/javascript" src="[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=2"></script>)</span><div class="openpl"> <script src="[!--news.url--]e/pl/more/?classid=[!--classid--]&id=[!--id--]&num=10"></script> <form action="[!--news.url--]e/pl/doaction.php" method="post" name="saypl" id="saypl" > <table width="100%" border="0" cellpadding="0" cellspacing="0" id="plpost"> <input name="nomember" type="hidden" id="nomember" value="1" checked="checked" /> <textarea name="saytext" rows="4" id="saytext" placeholder="我也说一句"></textarea> <input name="imageField" type="image" src="[!--news.url--]e/data/images/postpl.gif"/> <input name="id" type="hidden" id="id" value="[!--id--]" /> <input name="classid" type="hidden" id="classid" value="[!--classid--]" /> <input name="enews" type="hidden" id="enews" value="AddPl" /> <input name="repid" type="hidden" id="repid" value="0" /> <input type="hidden" name="ecmsfrom" value="[!--this.classlink--]"> </table> </form></div></section>
第二步,修改模板,公共模板,评论js调用模板
<ul class="wypl_list">[!--empirenews.listtemp--] <li><div class="username">[!--username--]</div><div class="pltext">[!--pltext--]</div><div class="pltime">[!--pltime--]</div></li>[!--empirenews.listtemp--]</ul>
最后一步,评论时间修改,匿名文字修改成“游客”,会员取消链接
/e/data/template/ 修改两个文件:pljstemp.txt pltemp.txt
增加图片,并且判断多图可以使用图片集
$titlepic='';$morepic='';if($r[morepic]){$fr=$empire->fetch1("select * from {$dbtbpre}ecms_shuoshuo where id='$r[id]'");$rexp="/r/n";$fexp="::::::";$rr=explode($rexp,$fr[morepic]);$count=count($rr);if ($count>2){for($i=1;$i<$count+1;$i++){$frt=explode($fexp,$rr[$i-1]);$listtemps.=('<li><a href="'.$frt[0].'" data-fancybox="group"><i><img src="'.$frt[0].'"></i></a></li>');}$titlepic.=('<ul class="mood_pic_a">'.$listtemps.'</ul>');}else if ($count>1){for($i=1;$i<$count+1;$i++){$frt=explode($fexp,$rr[$i-1]);$listtemps.=('<li><a href="'.$frt[0].'" data-fancybox="group"><i><img src="'.$frt[0].'"></i></a></li>');}$titlepic.=('<ul class="mood_pic_b">'.$listtemps.'</ul>');}else if ($count>0){for($i=1;$i<$count+1;$i++){$frt=explode($fexp,$rr[$i-1]);$listtemps.=('<li><a href="'.$frt[0].'" data-fancybox="group"><i><img src="'.$frt[0].'"></i></a></li>');}$titlepic.=('<ul class="mood_pic_c">'.$listtemps.'</ul>');}}$listtemp='<section><i class="mood_tx"><img src="[!--news.url--]skin/html/images/yangqq.jpg" class="moodhead"></i><div class="moodtext">[!--newstext--]'.$titlepic.'</div><span class="moodtime">[!--newstime--]</span><span class="btnpl">评论(<script type="text/javascript" src="[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=2"></script>)</span><div class="openpl"> <script src="[!--news.url--]e/pl/more/?classid=[!--classid--]&id=[!--id--]&num=10"></script> <form action="[!--news.url--]e/pl/doaction.php" method="post" name="saypl" id="saypl" > <table width="100%" border="0" cellpadding="0" cellspacing="0" id="plpost"> <input name="nomember" type="hidden" id="nomember" value="1" checked="checked" /> <textarea name="saytext" rows="4" id="saytext" placeholder="我也说一句"></textarea> <input name="imageField" type="image" src="[!--news.url--]e/data/images/postpl.gif"/> <input name="id" type="hidden" id="id" value="[!--id--]" /> <input name="classid" type="hidden" id="classid" value="[!--classid--]" /> <input name="enews" type="hidden" id="enews" value="AddPl" /> <input name="repid" type="hidden" id="repid" value="0" /> <input type="hidden" name="ecmsfrom" value="[!--this.classlink--]"> </table> </form></div></section>';
- 上一篇
- 下一篇