PHP写内容分页源码剖析

WBOY
WBOYオリジナル
2016-05-19 12:15:58816ブラウズ

 

所谓内容分页,就是根据你自己设定的标签,将较长的内容按你设置的标签来进行分页,本文涉及的两个地方,一个是地址的获取,网上有很多这样的分页教程,但是地址都是固定的,如果页面中有评论分页以及文章ID调用过来,就会非常麻烦,文中采用了PHP100视频教程中分页原理 (http://www.php100.com/html/shipinjiaocheng/PHP100shipinjiaocheng/2009/0416/807.html) 思路,有不清楚的童鞋可以看下此教程,同时运用了一些内容处理函数以及数组方面知识,本人头次写这样的文章,表述不清楚的还请见谅

先看下效果图:

 

更多这样的分页效果,在php100论坛有很多这样的样式,在这儿分享图片中的CSS样式代码:

CSS:

<ol class="dp-css">
<li class="alt"><span><span>DIV.digg {PADDING-RIGHT: </span><span class="value">3px</span><span>; PADDING-LEFT: </span><span class="value">3px</span><span>; PADDING-BOTTOM: </span><span class="value">3px</span><span>; MARGIN: </span><span class="value">3px</span><span>; PADDING-TOP: </span><span class="value">3px</span><span>; TEXT-ALIGN: </span><span class="value">center</span><span>}  </span></span></li>
<li>
<span>DIV.digg A {BORDER-RIGHT: </span><span class="value">#aaaadd</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; PADDING-RIGHT: </span><span class="value">5px</span><span>; BORDER-TOP: </span><span class="value">#aaaadd</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; PADDING-LEFT: </span><span class="value">5px</span><span>; PADDING-BOTTOM: </span><span class="value">2px</span><span>; MARGIN: </span><span class="value">2px</span><span>; BORDER-LEFT: </span><span class="value">#aaaadd</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; COLOR: </span><span class="value">#000099</span><span>; PADDING-TOP: </span><span class="value">2px</span><span>; BORDER-BOTTOM: </span><span class="value">#aaaadd</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; TEXT-DECORATION: </span><span class="value">none</span><span>}  </span>
</li>
<li class="alt">
<span>DIV.digg A:hover {BORDER-RIGHT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; BORDER-TOP: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; BORDER-LEFT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; COLOR: </span><span class="value">#000</span><span>; BORDER-BOTTOM: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>}  </span>
</li>
<li>
<span>DIV.digg A:active {BORDER-RIGHT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; BORDER-TOP: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; BORDER-LEFT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; COLOR: </span><span class="value">#000</span><span>; BORDER-BOTTOM: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>}  </span>
</li>
<li class="alt">
<span>DIV.digg SPAN.current {BORDER-RIGHT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; PADDING-RIGHT: </span><span class="value">5px</span><span>; BORDER-TOP: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; PADDING-LEFT: </span><span class="value">5px</span><span>; FONT-WEIGHT: </span><span class="value">bold</span><span>; PADDING-BOTTOM: </span><span class="value">2px</span><span>; MARGIN: </span><span class="value">2px</span><span>; BORDER-LEFT: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; COLOR: </span><span class="value">#fff</span><span>; PADDING-TOP: </span><span class="value">2px</span><span>; BORDER-BOTTOM: </span><span class="value">#000099</span><span> 1px </span><span class="value">solid</span><span>; BACKGROUND-COLOR: </span><span class="value">#000099</span><span>}  </span>
</li>
<li>
<span>DIV.digg SPAN.disabled {BORDER-RIGHT: </span><span class="value">#eee</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; PADDING-RIGHT: </span><span class="value">5px</span><span>; BORDER-TOP: </span><span class="value">#eee</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; PADDING-LEFT: </span><span class="value">5px</span><span>; PADDING-BOTTOM: </span><span class="value">2px</span><span>; MARGIN: </span><span class="value">2px</span><span>; BORDER-LEFT: </span><span class="value">#eee</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>; COLOR: </span><span class="value">#ddd</span><span>; PADDING-TOP: </span><span class="value">2px</span><span>; BORDER-BOTTOM: </span><span class="value">#eee</span><span> </span><span class="value">1px</span><span> </span><span class="value">solid</span><span>} </span>
</li>
</ol>
1 2  下一页
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。