Tuesday, September 2, 2014

Phân trang thì có rất nhiều kiểu loại mẫu mã.Nhiều cách bố trí cài đặt ví dụ như áp dụng theo cách chỉnh sửa HTML trong template hay là thêm một tiện ích.Để đơn giản cho việc cài đặt cũng như dỡ bỏ khi cần thiết ở đây ta chỉ cần thêm một tiện ích và dán code vào là xong.
Trong ảnh có tất cả 10 mẫu phân trang có đánh số thứ tự bên cạnh bạn thích loại nào thì lấy code tương ứng ở bên dưới


Mẫu 1
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}
.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}
.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:bold}
.showpageNum a{color:#000;padding:3px 8px;margin:0 4px;text-decoration:none;border:1px solid #999;-webkit-border-radius:3px;-moz-border-radius:3px;background:#f8b5a4 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKovY0VyKH8Tg6LwbcwwwHEMOGx52uH40m15oCkMJSyrVnmbe_yiQeJ-xlfFkaqN9m8NnkfK0m7p7KTEA-4QsLwPXGfbbbGxDT1YWNxYl88RkP0jsvDXPHW-2Vmwu9R5K_ceOtmy3RxpxJ/s90/pagenav1.png) 0 -60px repeat-x}
.showpageNum a:hover{border:1px solid #888;background:#f7cac9 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKovY0VyKH8Tg6LwbcwwwHEMOGx52uH40m15oCkMJSyrVnmbe_yiQeJ-xlfFkaqN9m8NnkfK0m7p7KTEA-4QsLwPXGfbbbGxDT1YWNxYl88RkP0jsvDXPHW-2Vmwu9R5K_ceOtmy3RxpxJ/s90/pagenav1.png) 0 -30px repeat-x}.showpageOf{margin:0 4px 0 0}
.showpagePoint{color:#666;padding:3px 8px;margin:2px;font-weight:bold;-webkit-border-radius:3px;-moz-border-radius:3px;border:1px solid #999;background:#f2f0f0 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKovY0VyKH8Tg6LwbcwwwHEMOGx52uH40m15oCkMJSyrVnmbe_yiQeJ-xlfFkaqN9m8NnkfK0m7p7KTEA-4QsLwPXGfbbbGxDT1YWNxYl88RkP0jsvDXPHW-2Vmwu9R5K_ceOtmy3RxpxJ/s90/pagenav1.png) 0 -5px repeat-x;text-decoration:none}" 
</style>
<script type='text/javascript'>
var postperpage=5;//Số bài viết mỗi lần phân trang
var numshowpage=5;//Số nút phân trang
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script type='text/javascript' src='https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/'></script>
Mẫu 2
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:normal}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;border:1px solid #999;-webkit-border-radius:3px;-moz-border-radius:3px;background:#b1a7c3 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuuRLCYQQYBLUwPklhjuomEATct6w-G6QA7eYKw5M3f4C-1KnevB7fR4csUroH0l6wXmmp2TNx0oqrQnnnQ9-pTpruOApng90w_E96ov5aWzqvrn5LOooSBKPKtGQY7ECkdf_VJ2aP3TvO/s90/pagenav2.png) 0 -60px repeat-x}.showpageNum a:hover{border:1px solid #888;background:#f7b36a url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuuRLCYQQYBLUwPklhjuomEATct6w-G6QA7eYKw5M3f4C-1KnevB7fR4csUroH0l6wXmmp2TNx0oqrQnnnQ9-pTpruOApng90w_E96ov5aWzqvrn5LOooSBKPKtGQY7ECkdf_VJ2aP3TvO/s90/pagenav2.png) 0 -30px repeat-x}.showpageOf{margin:0 4px 0 0}.showpagePoint{color:#444;text-shadow:0 1px 2px #333;padding:3px 8px;margin:2px;font-weight:700;-webkit-border-radius:3px;-moz-border-radius:3px;border:1px solid #999;background:#f7d5b0 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuuRLCYQQYBLUwPklhjuomEATct6w-G6QA7eYKw5M3f4C-1KnevB7fR4csUroH0l6wXmmp2TNx0oqrQnnnQ9-pTpruOApng90w_E96ov5aWzqvrn5LOooSBKPKtGQY7ECkdf_VJ2aP3TvO/s90/pagenav2.png) 0 0 repeat-x;text-decoration:none} 
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 3
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:normal}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;border-bottom:3px solid #fe9a2e;background:#f7f8e0}.showpageNum a:hover{border-bottom:3px solid #df01d7;background:#f6cee3}.showpageOf{margin:0 4px 0 0}.showpagePoint{color:#333;text-shadow:0 1px 2px #333;padding:3px 8px;margin:2px;font-weight:700;border-bottom:3px solid #fe9a2e;background:#f8e0f7;text-decoration:none}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 4
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:normal}.showpageNum a{padding:2px 8px;margin:0 4px;text-decoration:none;border-bottom:2px solid #5fb404;border-top:2px solid #5fb404;background:#effbf5}.showpageNum a:hover{border-bottom:2px solid #df01d7;background:#a9f5f2;border-top:2px solid #df01d7}.showpageOf{margin:0 4px 0 0}.showpagePoint{color:#fff;text-shadow:0 1px 2px #333;padding:2px 8px;margin:2px;font-weight:700;border-bottom:2px solid #5e610b;border-top:2px solid #5e610b;background:#5e610b;text-decoration:none}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 5
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:700}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;border:1px solid #999;-webkit-border-radius:3px;-moz-border-radius:3px;background:#ddd url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI01E5tslhFiP6NRIE45gHFFtFGw6TLqyPPn91eM5ZaZb2NugOFUnDPVeQTr19DzITSjT_zbHhy2-_r8WujTUkKgmkfGpWqnP2SekYN_dYmZKkJNMsRYqMsOzFb5buBD9U0iKGiHOBj5ia/s75/wp1.jpg) 0 -50px repeat-x}.showpageNum a:hover{border:1px solid #888;background:#ccc url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI01E5tslhFiP6NRIE45gHFFtFGw6TLqyPPn91eM5ZaZb2NugOFUnDPVeQTr19DzITSjT_zbHhy2-_r8WujTUkKgmkfGpWqnP2SekYN_dYmZKkJNMsRYqMsOzFb5buBD9U0iKGiHOBj5ia/s75/wp1.jpg) 0 -25px repeat-x}.showpageOf{margin:0 4px 0 0}.showpagePoint{color:#fff;text-shadow:0 1px 2px #333;padding:3px 8px;margin:2px;font-weight:700;-webkit-border-radius:3px;-moz-border-radius:3px;border:1px solid #999;background:#666 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI01E5tslhFiP6NRIE45gHFFtFGw6TLqyPPn91eM5ZaZb2NugOFUnDPVeQTr19DzITSjT_zbHhy2-_r8WujTUkKgmkfGpWqnP2SekYN_dYmZKkJNMsRYqMsOzFb5buBD9U0iKGiHOBj5ia/s75/wp1.jpg) 0 0 repeat-x;text-decoration:none}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 6
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#000;text-shadow:0 1px 2px #fff;font-weight:700}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;border:1px solid #919106;-webkit-border-radius:3px;-moz-border-radius:3px;background:#ddd url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvk47TjVoHzkRgw-uqQkYjyp2-1gxYFm1ETlpEcHRmE7RBy4R_LCfJZVZ7nNtgCekAA80DdJ5NIXaShQdaWuh0ocCmVxFW_Yff395iz0dEcfnqlJqh9qqGMKld4sLoaSFEg7qxhHbC5lgE/s75/wp2.jpg) 0 -50px repeat-x}.showpageNum a:hover{border:1px solid #aeae0a;background:#ccc url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvk47TjVoHzkRgw-uqQkYjyp2-1gxYFm1ETlpEcHRmE7RBy4R_LCfJZVZ7nNtgCekAA80DdJ5NIXaShQdaWuh0ocCmVxFW_Yff395iz0dEcfnqlJqh9qqGMKld4sLoaSFEg7qxhHbC5lgE/s75/wp2.jpg) 0 -25px repeat-x}.showpageOf{margin:0 5px 0 0}.showpagePoint{color:#fff;text-shadow:0 1px 2px #333;padding:3px 8px;margin:2px;font-weight:bold;-webkit-border-radius:3px;-moz-border-radius:3px;border:1px solid #919106;background:#666 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvk47TjVoHzkRgw-uqQkYjyp2-1gxYFm1ETlpEcHRmE7RBy4R_LCfJZVZ7nNtgCekAA80DdJ5NIXaShQdaWuh0ocCmVxFW_Yff395iz0dEcfnqlJqh9qqGMKld4sLoaSFEg7qxhHbC5lgE/s75/wp2.jpg) 0 0 repeat-x;text-decoration:none}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 7
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#fff}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;background:#363636 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCF4CPQAwHXkNl6sHMJf_xSoLAannWoe98xWFqxqPqXnZ_OhTTceENUy325tM_zBk5exylyoVEdOkjntxQ2vr1k_MqiOK4_dOLxPzJnOs0dWRdPJH5ah5ApY5flTvifF_6x-kRJgbokjCm/s75/wp3.jpg) 0 -25px repeat-x}.showpageNum a:hover{background:#044697 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCF4CPQAwHXkNl6sHMJf_xSoLAannWoe98xWFqxqPqXnZ_OhTTceENUy325tM_zBk5exylyoVEdOkjntxQ2vr1k_MqiOK4_dOLxPzJnOs0dWRdPJH5ah5ApY5flTvifF_6x-kRJgbokjCm/s75/wp3.jpg) 0 -50px repeat-x}.showpagePoint{color:#fff;padding:3px 8px;margin:2px;font-weight:700;background:#e30000 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCF4CPQAwHXkNl6sHMJf_xSoLAannWoe98xWFqxqPqXnZ_OhTTceENUy325tM_zBk5exylyoVEdOkjntxQ2vr1k_MqiOK4_dOLxPzJnOs0dWRdPJH5ah5ApY5flTvifF_6x-kRJgbokjCm/s75/wp3.jpg) 0 0 repeat-x;text-decoration:none}.showpageOf{margin:0 5px 0 0}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 8
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#fff}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;border-top:2px solid #000;border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;background:#666 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoUxLs2sKV7e5dm3WjQeD6qKiDctPIVCpbjtHPHOrnAde5QW5FRvJ5IQRu8gW7KGwXbrUcWaKlCZ31ssT9Hz2zKpU659LC2Ef2m0HyGrCB6xKQ7Zj-yvSodaBdGeIvf-wufl0T24ZDID8A/s75/wp4.jpg) 0 -25px repeat-x}.showpageNum a:hover{border-top:1px solid #999;border-left:1px solid #999;border-right:1px solid #999;border-bottom:2px solid #999;background:#999 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoUxLs2sKV7e5dm3WjQeD6qKiDctPIVCpbjtHPHOrnAde5QW5FRvJ5IQRu8gW7KGwXbrUcWaKlCZ31ssT9Hz2zKpU659LC2Ef2m0HyGrCB6xKQ7Zj-yvSodaBdGeIvf-wufl0T24ZDID8A/s75/wp4.jpg) 0 -50px repeat-x}.showpagePoint{color:#fff;padding:3px 8px;margin:2px;font-weight:700;border-top:2px solid #000;border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;background:#000 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoUxLs2sKV7e5dm3WjQeD6qKiDctPIVCpbjtHPHOrnAde5QW5FRvJ5IQRu8gW7KGwXbrUcWaKlCZ31ssT9Hz2zKpU659LC2Ef2m0HyGrCB6xKQ7Zj-yvSodaBdGeIvf-wufl0T24ZDID8A/s75/wp4.jpg) 0 0 repeat-x;text-decoration:none}.showpageOf{margin:0 5px 0 0}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 9
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#000;font-size:11px;margin:10px}.showpageArea a{color:#fff}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;background:#333 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEju-N4RAHpXo58F01t9bPCcm-I21ngFhyfguzXkAo-uEz0vyuGJxIs8YmmEq3Mn1szod0qC1C-vf93obSAtoGkwKYPE8LayC_eiAHSVDjYicUGXXzFYH77uQCRKmqYXjs_DTrd9MVhNHbkr/s75/wp5.jpg) 0 -50px repeat-x}.showpageNum a:hover{background:#666 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEju-N4RAHpXo58F01t9bPCcm-I21ngFhyfguzXkAo-uEz0vyuGJxIs8YmmEq3Mn1szod0qC1C-vf93obSAtoGkwKYPE8LayC_eiAHSVDjYicUGXXzFYH77uQCRKmqYXjs_DTrd9MVhNHbkr/s75/wp5.jpg) 0 -25px repeat-x}.showpagePoint{color:#fff;padding:3px 8px;margin:2px;font-weight:700;background:#06a2b9 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEju-N4RAHpXo58F01t9bPCcm-I21ngFhyfguzXkAo-uEz0vyuGJxIs8YmmEq3Mn1szod0qC1C-vf93obSAtoGkwKYPE8LayC_eiAHSVDjYicUGXXzFYH77uQCRKmqYXjs_DTrd9MVhNHbkr/s75/wp5.jpg) 0 0 repeat-x;text-decoration:none}.showpageOf{margin:0 5px 0 0}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Mẫu 10
<style type='text/css'>
.blog-pager,#blog-pager{font-size:normal}.showpageArea{font-family:verdana,arial,helvetica;color:#fff;font-size:11px;margin:10px;padding:8px 20px;background:#333}.showpageArea a{color:#fff}.showpageNum a{padding:3px 8px;margin:0 4px;text-decoration:none;background:#666}.showpageNum a:hover{background:#aeb404}.showpagePoint{color:#fff;padding:3px 8px;margin:2px;font-weight:700;background:#da6100;text-decoration:none}.showpageOf{margin:0 5px 0 0}
</style>
<script>
var postperpage=5;
var numshowpage=5;
var upPageWord="Prev";
var downPageWord="Next";
var home_page="/";
var urlactivepage=location.href;
</script>
<script src="https://googledrive.com/host/0B7dsLzZ8KnJmWDFyelBrOTJfa0U/"></script>
Lưu ý
Để tiện ích phân trang chạy mượt mà không những tại trang chủ mà khi vào trang nhãn không bị hiện tượng liệt kê 1 dãy bài(20 bài)và có khi còn không thấy tiện ích phân trang đâu nữa.Các bạn cần làm thêm công việc sau:
Các bạn vào chỉnh sửa mẫu tìm tới những đoạn code có dạng:
expr:href='data:label.url'
Và sửa nó thành:
expr:href='data:label.url + &quot;?&amp;max-results=5&quot;'
Tiếp đến bạn đặt đoạn javascript dưới đây vào ngay sau thẻ <head>
<script type='text/javascript'>
//<![CDATA[
/*---- ©:DautoCrazy.Blog-----*/
if(!location.href.match('max-results=')){if(location.href.match('/search/label/')){location.href = location.href + '?&max-results=5' ;}}
//]]>
</script>

Ở đây ta thống nhất mỗi lần phân trang trên mỗi trang hiển thị 5 bài và cài đặt số bài ở trang chủ cũng là 5 và số nút phân trang(numshowpage) hiển thị cũng là 5 số nút này tùy thuộc vào độ rộng của khung post bài mà bạn có thể thay đổi cho hợp lý.
Các bạn có thể tham khảo thêm tại ĐÂY
Và tại ĐÂY

0 comments:

Post a Comment

 

livestream Dịch vụ marketing / Dịch vụ marketing online dịch vụ marketing |dich vu marketing |dịch vụ digital marketing |Recycle plant VietNam |Duy Tan Recycle |HDPE recycle |Recycling in Viet Nam |PET Recycle |Quản lý con người |Quản trị rủi ro |Quản trị sự thay đổi |Kỹ năng lãnh đạo |Tư duy tích cực |Kỹ năng giao tiếp hiệu quả |Màn led tương tác thông minh |Màn hình tương tác thông minh |Màn hình tương tác |Giá màn hình tương tác thông minh |Màn hình tương tác 100 inch |Màn hình tương tác cảm ứng / Dịch vụ seo / Dich vu seo