用PHPCMS信息频道做的一个商家黄页,带点评,以下是点评的调用。
<!--点评内容-->
<div id="StoreReview">
<ul>
<?php
defined('IN_PHPCMS') or exit('Access Denied');
require_once PHPCMS_ROOT."/include/ip.class.php";
$i = 1;
$keyid = isset($keyid)? strval($keyid) : '';
$link = $linkfonta = $linkfontb = '';
foreach($CHANNEL as $channelid=>$cha)
{
if($cha['islink']) continue;
$i++;
$linkfonta = $channelid == $keyid ? '<font color=#f340cd><strong>' : '';
$linkfontb = $channelid == $keyid ? '</strong></font>' : '';
$link .= "<a href=\"?mod=comment&file=comment&action=manage&keyid=$channelid\" class='pagelink'>".$linkfonta.$cha['channelname'].$linkfontb."</a>";
if($i%15==0) $link .='<br/>'; else $link .=' | ';
}
foreach($MODULE as $module=>$m)
{
$i++;
if($m['iscopy']) continue;
if($module == 'phpcms') continue;
$linkfonta = $module == $keyid ? '<font color=#f340cd><strong>' : '';
$linkfontb = $module == $keyid ? '</strong></font>' : '';
$link .= "<a href=\"?mod=comment&file=comment&action=manage&keyid=$module\" class='pagelink'>".$linkfonta.$m['name'].$linkfontb."</a>";
if($i%15==0) $link .='<br/>'; else $link .=' | ';
}
$srchfrom = isset($srchfrom) ? $srchfrom : 0;
$keywords = isset($keywords) ? $keywords : '';
$itemid = isset($itemid) ? $itemid : '';
$page = isset($page) ? $page : '';
$passed = isset($passed) ? $passed : "1";
$referer = urlencode("?mod=".$mod."&file=comment&action=manage&passed=".$passed."&keyid=".$keyid."&itemid=".$itemid."&page=".$page);
$getip = new ip();
$pagesize = isset($pagesize) ? $pagesize : $PHPCMS['pagesize'];
if(!$page)
{
$page=1;
$offset=0;
}
else
{
$offset=($page-1)*$pagesize;
}
$condition = " AND passed=$passed ";
$condition .= $keywords ? " AND username LIKE '%$keywords%' OR content LIKE '%$keywords%' " : "";
$condition .= $itemid ? " AND itemid='$itemid' " : "";
$condition .= isset($ip) ? " AND ip='$ip' " : "";
$condition .= $keyid ? " AND keyid='$keyid' " : "";
$condition .= $srchfrom ? " AND addtime>$PHP_TIME-$srchfrom*86400 " : "";
$r = $db->get_one("SELECT COUNT(cid) AS num FROM ".TABLE_COMMENT." WHERE 1 $condition");
$number = $r['num'];
$pages = phppages($number,$page,$pagesize);
$comments = array();
$result = $db->query("SELECT * FROM ".TABLE_COMMENT." WHERE 1 $condition and keyid=13 ORDER BY cid DESC LIMIT 0,5");
while($r = $db->fetch_array($result))
{
$r['addtime'] = date('Y-m-d', $r['addtime']);
$r['score'] = $r['score'];
$r['score1'] = $r['score1'];
$r['score2'] = $r['score2'];
$r['score3'] = $r['score3'];
$r['gip']=$getip->getlocation($r['ip']);
$r['url'] = itemurl($r['keyid'],$r['itemid']);
$r['content'] = strip_textarea($r['content']);
$r['content'] = preg_replace_callback("/\[smile_[0-9]{1,3}\]/",'smilecallback',$r['content']);
$r['content'] = str_replace('[quote]','<div class="comment_quote">',$r['content']);
$r['content'] = str_replace('[/quote]','</div>',$r['content']);
$r['content'] = str_replace('[blue]','<span style="color:blue">',$r['content']);
$r['content'] = str_replace('[/blue]','<span><br />',$r['content']);
if(!$MOD['enablekillurl'] && $MOD['enableparseurl']) $r['content'] = preg_replace("/(http:\/\/)?(([A-Za-z0-9_-])+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})/i",'<a href="\0" target="_blank" >\0</a>',$r['content']);
if($MOD['enablekillurl']) $r['content'] = preg_replace("/(www\.)([A-Za-z0-9_-]+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})/i",'\1***.\3',$r['content']);
$comments[] = $r;
}
?>
<?php defined('IN_PHPCMS') or exit('Access Denied'); ?>
<?php if(is_array($comments)) foreach($comments AS $i => $comment) { ?>
<li class="clear">
<div class="UserInfo">
<a href={PHPCMS_PATH}member/member.php?username={$comment[username]} target="_blank" title={$comment[username]} class="level2" ><img src=\'#\'" $username=$comment[username];
$m = $db->get_one("SELECT * FROM ".TABLE_MEMBER." m , ".TABLE_MEMBER_INFO." i WHERE m.userid=i.userid AND m.username='$username' ","CACHE",86400);
if(!$m) showmessage($LANG['username_not_exist']);
@extract($m);
$userface = $userface ? imgurl($userface) : PHPCMS_PATH."member/images/defaultface.gif";
echo $userface;
?> title="{$comment[username]}的个人家园" /></a>
<a href={PHPCMS_PATH}member/member.php?username={$comment[username]} target="_blank" title={$comment[username]} class="level2" ><?php echo $comment['username'];?></a>
</div>
<div class="ReviewContent">
<h4><a href={$comment['url']} target="_blank"><?php
$infoidv = $comment['itemid'];
$infoss = $db->get_one("SELECT infoid,title FROM ".TABLE_INFO_13." WHERE infoid=$infoidv");
$infotitle = $infoss['title'];
echo $infotitle;
?></a></h4>
<ul class="clear">
<li>服务</li><li><div class="star-rating"><span style="width: 56px;" class="current-rating"><?php echo $comment['score'];?>颗星星</span></div>
</li>
<li>口味</li><li><div class="star-rating"><span style="width: 56px;" class="current-rating"><?php echo $comment['score1'];?>颗星星</span></div>
</li>
<li>环境</li><li><div class="star-rating"><span style="width: 56px;" class="current-rating"><?php echo $comment['score2'];?>颗星星</span></div>
</li>
<li>性价比</li><li><div class="star-rating"><span style="width: 42px;" class="current-rating"><?php echo $comment['score3'];?>颗星星</span></div>
</li>
</ul>
<p><?php $rr=str_cut(strip_tags(trim($comment['content'])), 100); echo $rr;?>[<a
href={$comment['url']}
target="_blank">全文</a>]<span>[<?php echo $comment['addtime'];?>]</span></p>
<p class="StoreReviewContral"> <a class="IconFlower" href="{$comment['url']}" class="Flower">鲜花(<span id="flower{$comment[cid]}">{$comment[support]}</span>)</a><a href="{$comment['url']}#content">我要回应</a></p>
</div>
</li>
<?php } ?>
</ul>
<p id="StroeReviewMore"><a href="/page/" class="MoreBlack">看看其它点评</a></p>
</div>
</div>
<!-- 点评区end -->
相关演示: [url]http://www.kanjz.com/Page/[/url]