JTBC分页导航样式更改

作者:我就是个世界 发表于:2010-05-27
根据客户的要求,需要更改分页导航样式,并在分页导航中精确显示分类文章数据总量,如下例子:

[code]共20632条 当前第1/413页 50/页 首页 上页 下页 尾页 转到:[ ]页 GO[/code]

那就需要更改原先的样式, JTBC[ASP版]这个文件在(ASP)JTBC_CMS_1.0\common\template\tpl_common.jtbc中,最新1.0 Final版在第107行,旧版本在85行:

更改:[separator]
[code]
      <tpl_default><![CDATA[{@firstpage}<span class="ash">{$=itake('global.lng_cutepage.firstpage', 'lng')}</span>{|}<a href="{$URLfirst}">{$=itake('global.lng_cutepage.firstpage', 'lng')}</a>{@firstpage} {@prepage}<span class="ash">{$=itake('global.lng_cutepage.prepage', 'lng')}</span>{|}<a href="{$URLpre}">{$=itake('global.lng_cutepage.prepage', 'lng')}</a>{@prepage} {@nextpage}<span class="ash">{$=itake('global.lng_cutepage.nextpage', 'lng')}</span>{|}<a href="{$URLnext}">{$=itake('global.lng_cutepage.nextpage', 'lng')}</a>{@nextpage} {@lastpage}<span class="ash">{$=itake('global.lng_cutepage.lastpage', 'lng')}</span>{|}<a href="{$URLlast}">{$=itake('global.lng_cutepage.lastpage', 'lng')}</a>{@lastpage} {$=itake('global.lng_cutepage.chpage', 'lng')}<input type="text" style="width: 30px" id="go-page-num" value="{$xpagenum}" maxlength="5" onkeyup="this.value=get_num(this.value);if (this.value>{$pagenums}) this.value={$pagenums};" class="text" /> <input type="button" value="GO" onclick="location_href('{$goURL}');" class="button" /> {$npagenum}/{$pagenums} {$pagesize}{$=itake('global.lng_cutepage.perpage', 'lng')}]]></tpl_default>
[/code]
为:
[code]
      <tpl_default><![CDATA[共<span class="red">{$count}</span>条  当前第<span class="red">{$npagenum}/{$pagenums}</span>页 <span class="red">{$pagesize}</span>{$=itake('global.lng_cutepage.perpage', 'lng')}   {@firstpage}<span class="ash">{$=itake('global.lng_cutepage.firstpage', 'lng')}</span>{|}<a href="{$URLfirst}">{$=itake('global.lng_cutepage.firstpage', 'lng')}</a>{@firstpage} {@prepage}<span class="ash">{$=itake('global.lng_cutepage.prepage', 'lng')}</span>{|}<a href="{$URLpre}">{$=itake('global.lng_cutepage.prepage', 'lng')}</a>{@prepage} {@nextpage}<span class="ash">{$=itake('global.lng_cutepage.nextpage', 'lng')}</span>{|}<a href="{$URLnext}">{$=itake('global.lng_cutepage.nextpage', 'lng')}</a>{@nextpage} {@lastpage}<span class="ash">{$=itake('global.lng_cutepage.lastpage', 'lng')}</span>{|}<a href="{$URLlast}">{$=itake('global.lng_cutepage.lastpage', 'lng')}</a>{@lastpage} {$=itake('global.lng_cutepage.chpage', 'lng')}<input type="text" style="width: 30px" id="go-page-num" value="{$xpagenum}" maxlength="5" onkeyup="this.value=get_num(this.value);if (this.value>{$pagenums}) this.value={$pagenums};" class="text" /> <input type="button" value="GO" onclick="location_href('{$goURL}');" class="button" /> ]]></tpl_default>
[/code]

保存后,删除缓存,刷新看效果.  [color=#FF0000]注意以下两条:[/color]

1. 如果出现如下错误,说明你没有保存为UTF8编码,使用UTF8编码保存即可,当然你也可以使多语言方案来解决,这个文章中不使用中文,也就无所谓编码问题了,直接保存即可.因为我没有用多语言,所以直接把中文写到这里了!
[code]
Microsoft VBScript 运行时错误 错误 '800a01a8'

缺少对象: 'objxml.documentelement'

C:\WWWROOT\ZGSXJJLS\WEB\ARTICLE\../common/incfiles/inc.asp,行 541
[/code]

2. 如果文章总数量不显示,直接显示{$count},说明变量{$count}没有被解析,原因是最新版的文件里去掉了这个变量,你需要手动添加这个变量.

在文件(ASP)JTBC_CMS_1.0\common\incfiles\inc.asp中大约第1357行的位置,

[code]
      tmpstr = replace(tmpstr, "{$goURL}", iurl("li_page", "' + get_id('go-page-num').value + '", nurltype, "folder=" & ncreatefolder & ";filetype=" & ncreatefiletype & ";burls=" & nurl))
[/code]
下面添加如下代码即可:
[code]tmpstr = replace(tmpstr, "{$count}", pagers.recordcount)[/code]
版权声明

未经许可,不得转载。