国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 帝國Empire > 正文

如何對帝國cms 列表頁分頁樣式修改美化

2024-08-30 19:07:16
字體:
來源:轉載
供稿:網友

【1】自己修改帝國cms默認的分頁樣式(css),這樣做的好處是你不用去改動帝國的核心文件,方便以后升級。

【2】自己動手去修改帝國的分頁(php+css),帝國的分頁在e>class>下的t_functions.php這個文件里。

===============================================

列表頁模板[!–show.page–]:分頁導航(下拉式) 大概在10-98行;

列表頁模板[!–show.listpage–]:分頁導航(列表式) 在101-169行;

內容頁模板(返回內容分頁):分頁導航 在172-228行;

內容頁模板(返回下拉式內容分頁導航):標題式分頁導航 在231-262行。

===============================================

上面大概介紹了下這個文件下有那些分頁,那下面我們就來修改程序分頁,但是又不會在升級程序時候帶來麻煩。

第一步:進入帝國cms后臺,點擊系統設置->系統參數設置->信息設置:里面有個”列表分頁函數(列表)”選項,將里面的函數名修改為user_ShowListMorePage
第二部:復制t_function.php列表式分頁代碼到 e/class/userfun.php 之間

下面我把分頁導航(列表式)拿出來,并帶上了注釋,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//列表模板之列表式分頁
function sys_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search="",$add){
global $fun_r,$public_r
//num是取得的當前總的文章數,line是欄目設定里的一頁顯示多少文章數。如果當前文章總數少于設定數,中斷程序返回,并且什么也不顯示。
if($num<=$line)
{
$pager['showpage']='';
return $pager;
}
//文件名
if(empty($add['dofile']))
{
$add['dofile']='index';
}
//靜態頁數
$repagenum=$add['repagenum'];
//listpagelistnum是"系統參數設置" 里的 "信息設置" 下的 "列表分頁函數(列表)"下的 "每頁顯示12個頁碼"這一項。
$page_line=$public_r['listpagelistnum'];
//這個$snum可以控制 "當前頁" 顯示的位置,設置成2,當前頁就顯示在第3個位置。
$snum=2;
//$totalpage=ceil($num/$line);//取得總頁數
$firststr='<a title="Total record">?<b>'.$num.'</b> </a>??';//顯示總文章數
//上一頁
if($page&lt;&gt;1)
{
//若當前頁不是第一頁,則顯示它的上一頁鏈接
//$dolink是欄目的地址,$type是網頁文件的擴展名,比如 .html ,那個$type之前有個點,是起連接作用的連接符,也就是說$type里面的內容是 .html
$toppage='<a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a>?';
$pagepr=$page-1;
if($pagepr==1)
{
$prido=$add['dofile'].$type;
}
else
{
$prido=$add['dofile'].'_'.$pagepr.$type;
}
$prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';
}
//下一頁
if($page!=$totalpage)
{
//如果當前頁不是最后一頁,則顯示它的下一頁鏈接
$pagenex=$page+1;
$nextpagelink=$repagenum&amp;&amp;$repagenum&lt;$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$type;
$lastpagelink=$repagenum&amp;&amp;$repagenum&lt;$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add['dofile'].'_'.$totalpage.$type;
$nextpage='?<a href="'.$nextpagelink.'">'.$fun_r['nextpage'].'</a>';
$lastpage='?<a href="'.$lastpagelink.'">'.$fun_r['lastpage'].'</a>';
}
//通過判斷當前頁碼與上面講述的snum的大小,確定頁碼顯示的狀態。如果$page-$snum&lt;1,$starti賦值為1,否則$starti賦值為$page-$snum。
$starti=$page-$snum&lt;1?1:$page-$snum;
$no=0;
//此處的for循環就是用來顯示頁碼的,包括從第幾個頁碼開始顯示,以及當前頁碼加粗和顯示多少個頁碼
for($i=$starti;$i&lt;=$totalpage&amp;&amp;$no&lt;$page_line;$i++)
{
$no++;
//如果是當前頁碼,則加粗,有需要修改當前頁碼樣式的可在此修改
if($page==$i)
{
$is_1="<b>";
$is_2="</b>";
}
//如果當前頁是首頁
elseif($i==1)
{
$is_1='<a href="'.$dolink.$add['dofile'].$type.'">';
$is_2="</a>";
}
//其余的頁碼,可以通過給a加樣式來修改顯示效果
else
{
$thispagelink=$repagenum&amp;&amp;$repagenum&lt;$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
$is_1='<a href="'.$thispagelink.'">';
$is_2="</a>";
}
$returnstr.='?'.$is_1.$i.$is_2;//$returnstr即是生成的顯示頁號的代碼
}
$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
$pager['showpage']=$returnstr;
return $pager;
}

下面我們就自己動手弄一個分頁把:

第一步:進入帝國cms后臺,點擊系統設置->系統參數設置->信息設置:里面有個”列表分頁函數(列表)”選項,將里面的函數名修改為user_ShowListMorePage

第二部:到 e/class/userfun.php 之間插入下面代碼

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function user_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search=""){
global $fun_r,$public_r;
if($num&lt;=$line)
{
$pager['showpage']='';
return $pager;
}
$page_line=$public_r['listpagelistnum'];
$snum=2;

//上一頁
if($page&lt;&gt;1)
{
$toppage='<a class="disabled" href="'.$dolink.'index'.$type.'">'.$fun_r['startpage'].'</a>'; //首頁
$pagepr=$page-1;
if($pagepr==1)
{
$prido="index".$type;
}
else
{
$prido="index_".$pagepr.$type;
}
$prepage='<a class="disabled" href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>'; //上一頁
}
//下一頁
if($page!=$totalpage)
{
$pagenex=$page+1;
$nextpage='<a class="disabled" href="'.$dolink.'index_'.$pagenex.$type.'">'.$fun_r['nextpage'].'</a>'; //下一頁
$lastpage='<a class="disabled" href="'.$dolink.'index_'.$totalpage.$type.'">'.$fun_r['lastpage'].'</a>'; //最后一頁
}
$starti=$page-$snum&lt;1?1:$page-$snum;
$no=0;
for($i=$starti;$i&lt;=$totalpage&amp;&amp;$no&lt;$page_line;$i++) //詳細頁碼信息
{
$no++;
if($page==$i)
{
$is_1="<a class="cur">"; //當前
$is_2="</a>";
}
elseif($i==1)
{
$is_1='<a href="'.$dolink.'index'.$type.'">'; //第一頁
$is_2="</a>";
}
else
{
$is_1='<a href="'.$dolink.'index_'.$i.$type.'">'; //其他頁
$is_2="</a>";
}
$returnstr.=$is_1.$i.$is_2;
}
$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
$pager['showpage']=$returnstr;
return $pager;
}

第三步:在你的列表頁中寫上分頁就好了【[!–show.listpage–]】

 

=============================================================

下面就來看看我最后的成果把

如何對帝國cms 列表頁分頁樣式修改美化

1
<div class="pageBox pTB20"><a class="cur">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="/liaotian/index_6.html">6</a><a href="#">7</a><a href="#">8</a><a href="#" class="disabled">下一頁</a><a href="#" class="disabled">尾頁</a></div>

css:

1
2
3
4
5
6
7
8
/*** page
-------------------------------------------------------------- ****/
.pageBox {text-align: center;}
.pageBox a {border:1px solid #ddd;display:inline-block;margin-right:6px;color: #707070;width:34px;height:34px;font:bold 14px/34px arial;}
.pageBox a:hover,.pageBox a:active{background:#3aa9f2;color: #FFFFFF;text-decoration: none;}
.pageBox .cur { background: #3aa9f2;border: 1px solid #3aa9f2;text-decoration: none;}
.pageBox a.cur {color: #fff;}
.pageBox .disabled {width: 79px;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 米泉市| 定陶县| 阳春市| 鄂伦春自治旗| 苍梧县| 宁陵县| 宁阳县| 前郭尔| 临沭县| 肥城市| 抚顺市| 鄂伦春自治旗| 延津县| 丽水市| 定兴县| 宣武区| 会理县| 六安市| 盐津县| 黄骅市| 文山县| 正定县| 凌源市| 云梦县| 孟州市| 拉萨市| 丰镇市| 巴彦县| 商都县| 东丰县| 乾安县| 页游| 平凉市| 凤庆县| 抚顺县| 广安市| 开平市| 黑龙江省| 三穗县| 芷江| 广州市|