翻页组件完整代码
做主题不想自己写翻页的特效怎么办?直接用现成的把。
1、在列表页的模板文件添加代码
<divclass="pagebar">{template:pagebar}</div>2、在主题的文件夹的template目录,创建pagebar.php文件,写入代码
{if$pagebar&&$pagebar.PageAll>1}
{foreach$pagebar.buttonsas$k=>$v}
{if$pagebar.PageNow==$k}
<spanclass="now-page">{$k}</span>
{else}
<ahref="{$v}">{$k}</a>
{/if}
{/foreach}
{/if}3、在css页面写入
.pagebar{width:100%;margin:0auto;padding:15px010px;font-size:0;text-align:center;border-radius:3px;box-sizing:border-box;}
.pagebar.now-page{font-size:14px;color:#fff;font-weight:400;padding:5px10px;margin:05px5px;border:1pxsolid#0188fb;border-radius:2px;background:#0188fb;display:inline-block}
.pagebara{margin:2px;padding:5px10px;font-size:14px;color:#777;font-weight:400;border:1pxsolid#e2e2e2;border-radius:2px;background:#fff;display:inline-block}
.pagebara:hover{color:#fff;border:1pxsolid#0188fb;background:#0188fb}
.pagebar{box-shadow:01px5px0rgba(0,0,0,0.05)}4、如果想让样式加上汉语标识,可以在主题目录的include.php文件里的ActivePlugin函数添加代码
functionActivePlugin_ytecn()
{
global$zbp;
$zbp->lang['msg']['first_button']='首页';
$zbp->lang['msg']['prev_button']='上页';
$zbp->lang['msg']['next_button']='下页';
$zbp->lang['msg']['last_button']='尾页';
}5、完。



