24
Jan.2011
第一步:
在栏目下的index.php中加入如下语句
第二步:
在模板管理内输入: "模块名.tpl.module" 对 "detail" 节点进行修改,在需要调用显示评论框的的位置加入:
这样,就带有评论功能了,如果需要,还可以显示出前几条评论内容,调用方法如下
函数的参数说明:
ap_review_input_form($GLOBALS['ngenre'] , $_GET['id'])
关键字,对应ID
ap_review_output_note($GLOBALS['ngenre'] , $_GET['id'], 5)
关键字,对应ID,前N条记录
第三步:
在\support\review\common\api\review.inc.php 第19行修改:
为:
这样在使用ap_review_output_note函数输出出前几条评论内容的时候就不会输出隐藏的评论了。
注: 评论调用模板在 \support\review\common\template\api.jtbc中修改。
附带我修改好的模板:
api.jtbc
<?xml version="1.0" encoding="utf-8"?>
<xml mode="jtbc" author="jetiben">
<configure>
<node>item</node>
<field>name,tpl_default</field>
<base>item_list</base>
</configure>
<item_list>
<item>
<name><![CDATA[input_form]]></name>
<tpl_default><![CDATA[
<div class="review">
<div class="h3_tt">
<h3><img src="{$=#global_images_route}public/small/sico.gif" border="0" /> <strong><a href="{$=ii_get_actual_route(AP_SUPPORT_REVIEW_GENRE)}/?type=list&keyword={$keyword}&fid={$fid}" target="_blank"><span class="c-f60">{$=ii_itake('global.' . AP_SUPPORT_REVIEW_GENRE . ':api.view', 'lng')}</span></a></strong></h3>
</div>
<div class="h3_ct">
<form name="form" method="post" action="{$=ii_get_actual_route(AP_SUPPORT_REVIEW_GENRE)}/index.php?action=add&keyword={$keyword}&fid={$fid}&backurl={$=urlencode($GLOBALS['nurl'])}">
<table cellpadding="0" cellspacing="0" class="tablen">
<tr>
<td width="80" height="25">{$=ii_itake('global.' . AP_SUPPORT_REVIEW_GENRE . ':config.content', 'lng')}</td>
<td><textarea rows="5" name="content" cols="75" class="textarea"></textarea></td>
</tr>
<tr>
<td height="35"></td>
<td><input type="submit" name="submit" value="{$=ii_itake('global.lng_config.submit','lng')}" class="button"> <input type="reset" name="reset" value="{$=ii_itake('global.lng_config.reset','lng')}" class="button"></td>
</tr>
</table>
</form>
</div>
</div>
]]></tpl_default>
</item>
<item>
<name><![CDATA[output_note]]></name>
<tpl_default><![CDATA[
<div class="review">{@recurrence_ida}
<div class="h3_tt">
<h3><img src="{$=#global_images_route}public/small/sico.gif" border="0" /> <strong><span class="c-f60">{$author}</span></strong></h3>
<span class="ip"> [{$=ii_format_ip(ii_htmlencode($GLOBALS['RS_authorip']), 2)}]</span>
<span class="more">{$time}</span>
</div>
<div class="h3_ct">{$content}</div>
{@recurrence_ida}
</div>
]]></tpl_default>
</item>
</item_list>
</xml>
css:
.h3_tt {position:relative;height:29px;border:solid #e1e1e1 1px;border-top:0;background:url(../images/h3_tt_bg.gif) repeat-x;margin-top:10px;}
.h3_tt h3 {float:left;display:inline;margin:0 15px 0 10px;font-size:12px;color:#555;line-height: 29px;}
.h3_tt .ip {position:absolute;top:5px;color:#9b9b9b;}
.h3_tt .more {position:absolute;right:10px;top:5px;color:#9b9b9b;}
.h3_tt .more a, .boxshort_commentItem .more a {font-weight:bold;text-decoration:underline;}
.h3_ct {border:solid #e1e1e1 1px;border-top:0;padding:10px;text-indent:2em;}
在栏目下的index.php中加入如下语句
require('../support/review/common/api/review.inc.php');
第二步:
在模板管理内输入: "模块名.tpl.module" 对 "detail" 节点进行修改,在需要调用显示评论框的的位置加入:
{$=ap_review_input_form($GLOBALS['ngenre'] , $_GET['id'])}
这样,就带有评论功能了,如果需要,还可以显示出前几条评论内容,调用方法如下
{$=ap_review_output_note($GLOBALS['ngenre'] , $_GET['id'], 5)}
函数的参数说明:
引用
ap_review_input_form($GLOBALS['ngenre'] , $_GET['id'])
关键字,对应ID
ap_review_output_note($GLOBALS['ngenre'] , $_GET['id'], 5)
关键字,对应ID,前N条记录
第三步:
在\support\review\common\api\review.inc.php 第19行修改:
$tsqlstr = "select * from $tdatabase where " . ii_cfnames($tfpre, 'keyword') . "='$tkeyword' and " . ii_cfnames($tfpre, 'fid') . "=$tfid order by " . ii_cfnames($tfpre, 'time') . " desc limit 0,$ttopx";
为:
$tsqlstr = "select * from $tdatabase where " . ii_cfnames($tfpre, 'keyword') . "='$tkeyword' and " . ii_cfnames($tfpre, 'fid') . "=$tfid and " . ii_cfnames($tfpre, 'hidden') . "=0 order by " . ii_cfnames($tfpre, 'time') . " desc limit 0,$ttopx";
这样在使用ap_review_output_note函数输出出前几条评论内容的时候就不会输出隐藏的评论了。
注: 评论调用模板在 \support\review\common\template\api.jtbc中修改。
附带我修改好的模板:
api.jtbc
<?xml version="1.0" encoding="utf-8"?>
<xml mode="jtbc" author="jetiben">
<configure>
<node>item</node>
<field>name,tpl_default</field>
<base>item_list</base>
</configure>
<item_list>
<item>
<name><![CDATA[input_form]]></name>
<tpl_default><![CDATA[
<div class="review">
<div class="h3_tt">
<h3><img src="{$=#global_images_route}public/small/sico.gif" border="0" /> <strong><a href="{$=ii_get_actual_route(AP_SUPPORT_REVIEW_GENRE)}/?type=list&keyword={$keyword}&fid={$fid}" target="_blank"><span class="c-f60">{$=ii_itake('global.' . AP_SUPPORT_REVIEW_GENRE . ':api.view', 'lng')}</span></a></strong></h3>
</div>
<div class="h3_ct">
<form name="form" method="post" action="{$=ii_get_actual_route(AP_SUPPORT_REVIEW_GENRE)}/index.php?action=add&keyword={$keyword}&fid={$fid}&backurl={$=urlencode($GLOBALS['nurl'])}">
<table cellpadding="0" cellspacing="0" class="tablen">
<tr>
<td width="80" height="25">{$=ii_itake('global.' . AP_SUPPORT_REVIEW_GENRE . ':config.content', 'lng')}</td>
<td><textarea rows="5" name="content" cols="75" class="textarea"></textarea></td>
</tr>
<tr>
<td height="35"></td>
<td><input type="submit" name="submit" value="{$=ii_itake('global.lng_config.submit','lng')}" class="button"> <input type="reset" name="reset" value="{$=ii_itake('global.lng_config.reset','lng')}" class="button"></td>
</tr>
</table>
</form>
</div>
</div>
]]></tpl_default>
</item>
<item>
<name><![CDATA[output_note]]></name>
<tpl_default><![CDATA[
<div class="review">{@recurrence_ida}
<div class="h3_tt">
<h3><img src="{$=#global_images_route}public/small/sico.gif" border="0" /> <strong><span class="c-f60">{$author}</span></strong></h3>
<span class="ip"> [{$=ii_format_ip(ii_htmlencode($GLOBALS['RS_authorip']), 2)}]</span>
<span class="more">{$time}</span>
</div>
<div class="h3_ct">{$content}</div>
{@recurrence_ida}
</div>
]]></tpl_default>
</item>
</item_list>
</xml>
css:
.h3_tt {position:relative;height:29px;border:solid #e1e1e1 1px;border-top:0;background:url(../images/h3_tt_bg.gif) repeat-x;margin-top:10px;}
.h3_tt h3 {float:left;display:inline;margin:0 15px 0 10px;font-size:12px;color:#555;line-height: 29px;}
.h3_tt .ip {position:absolute;top:5px;color:#9b9b9b;}
.h3_tt .more {position:absolute;right:10px;top:5px;color:#9b9b9b;}
.h3_tt .more a, .boxshort_commentItem .more a {font-weight:bold;text-decoration:underline;}
.h3_ct {border:solid #e1e1e1 1px;border-top:0;padding:10px;text-indent:2em;}
相关日志
php代码格式化工具
smart模板
PHP报错:Warning: session_start() [function.session-start]: open(....php5Tempsess... 的解决方法
[2.x标签说明] 飞飞CMS2.0标签大集合
php截取字符串函数substr()、mb_substr()和mb_strcut的区别
php代码格式化工具
smart模板
PHP报错:Warning: session_start() [function.session-start]: open(....php5Tempsess... 的解决方法
[2.x标签说明] 飞飞CMS2.0标签大集合
php截取字符串函数substr()、mb_substr()和mb_strcut的区别
