(1)调用会员头像:
{get_memberavatar($r[‘userid‘],1,45)}
只要能够调用到userid,那么这段代码在哪里都可以使用:首页、栏目页、文章页。
这里我就用get来调用member表里面的userid字段。
/*这里就可以获取到userid*/ {pc:get sql="select * from v9_member order by regdate desc" num="6"} {loop $data $r} <img src="{get_memberavatar($r[userid],1,90)}" width="55" height="55" alt="{$r[username]}" target="_blank" /> {/loop} {/pc}
(2)phpcms分页样式及前台调用:
分页样式:
?/* 分页样式,直接放置在css文件中加载即可*/ #pages { padding:14px 0 10px; font-family:宋体 } #pages a { display:inline-block; height:22px; line-height:22px; background:#fff; border:1px solid #e3e3e3; text-align:center; color:#333; padding:0 10px} #pages a.a1 { background:url(../images/admin_img/pages.png) no-repeat 0 5px; width:56px; padding:0 } #pages a:hover { background:#f1f1f1; color:#000; text-decoration:none } #pages span { display:inline-block; height:22px; line-height:22px; background:#5a85b2; border:1px solid #5a85b2; color:#fff; text-align:center;padding:0 10px} .page .noPage { display:inline-block; width:56px; height:22px; line-height:22px; background:url(../img/icu/titleBg.png) repeat-x 0 -55px ; border:1px solid #e3e3e3; text-align:center; color:#a4a4a4; }
前台调用分页:
? <!--分页前台调用--> <div id="pages" style="margin-top:20px; text-align: center;"> {$pages} </div>
(3)前台调用全站搜索代码:
?<form action="index.php?m=search&c=index&a=init" method="get" target="_blank"> <input type="hidden" name="m" value="search"/> <input type="hidden" name="c" value="index"/> <input type="hidden" name="a" value="init"/> <input type="hidden" name="typeid" value="1" id="typeid"/> <input type="hidden" name="siteid" value="1" id="siteid"/> <input name="q" id="q" type="text" value="请输入……"/> <input name="submit"type="image" value="" /> </form>
(4)前台评论框调用代码:
? <iframe src="{APP_PATH}index.php?m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1" width="100%" height="100%" id="comment_iframe" frameborder="0" scrolling="no"> </iframe>
(5)文章内容页显示点击数量:
需要用到jQuery:
?<script type="text/javascript" src="{JS_PATH}jquery.min.js"></script>
需放在页面底部:
?<script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
具体的数量值在span里面:
?<span id="hits"></span>
(6)详情页调用上一篇下一篇:
方法一:
? <div class="info"> <span>上一篇:<a href="{$previous_page[url]}">{$previous_page[title]}</a></span> <span>下一篇:<a href="{$next_page[url]}">{$next_page[title]}</a></span> </div>
方法二:
?/*上一篇:*/ {pc:get sql="SELECT * FROM v9_news WHERE id < $id ORDER BY id DESC" num="1" return="p"} {loop $p $pv} {php $pid = "id = $pv[id]"} {pc:content action="lists" catid="$catid" where="$pid" order="id DESC" num="1"} <ul> {loop $data $key $val} <li> <a href="{$val[‘url‘]}">{$val[‘title‘]}</a></li> {/loop} </ul> {/pc} {/loop} {/pc}
?/*下一篇:*/ {pc:get sql="SELECT * FROM v9_news WHERE id > $id ORDER BY id ASC" num="1" return="ne"} {loop $ne $nev} {php $neid = "id = $nev[id]"} {pc:content action="lists" catid="$catid" where="$neid" order="id DESC" num="1"} <ul> {loop $data $key $val} <li> <a href="{$val[‘url‘]}">{$val[‘title‘]}</a></li> {/loop} </ul> {/pc} {/loop} {/pc}
(7)调用相关文章
{pc:content action=”relation” relation=”$relation” catid=”$catid” num=”5″ keywords=”$rs[keywords]“} {loop $data $r} <li><a href=”{$r[url]}” target=”_blank”>{$r[title]}</a><span>({date(‘Y-m-d’,$r[inputtime])})</span></li> {/loop} {/pc}
时间: 2024-10-23 11:21:54