New pagination style and url_friendly on pagination

master
pecesama 2007-04-05 23:03:40 +00:00
parent eadfd21d97
commit 4b0fc4bf0d
2 changed files with 39 additions and 25 deletions

View File

@ -26,7 +26,19 @@
$id_post = $_GET["post"]; $id_post = $_GET["post"];
} else { } else {
if (isset($param_url[1]) && $param_url[1]=="post") { if (isset($param_url[1]) && $param_url[1]=="post") {
$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null; $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
} else {
$id_post = NULL;
}
}
if (isset($_GET["page"])) {
$page_num = $_GET["page"];
} else {
if (isset($param_url[1]) && $param_url[1]=="page") {
$page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
} else {
$page_num = NULL;
} }
} }
@ -40,8 +52,8 @@
$limit=$conf->postLimit; $limit=$conf->postLimit;
if(isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page']>0) { // Is defined the page and is numeric? if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
$from = (($_GET['page']-1) * $limit); $from = (($page_num-1) * $limit);
} else { } else {
$from = 0; $from = 0;
} }
@ -105,7 +117,8 @@
} }
} }
echo pagination($tumble->getPostsNumber(), $limit, isset($_GET['page']) ? $_GET['page'] : 1, "index.php", 2); // Shows the pagination echo pagination($tumble->getPostsNumber(), $limit, isset($page_num) ? $page_num : 1, array($conf->urlGelato."/index.php/page/[...]/","[...]"), 2);
} else { } else {
$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error"); $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");

View File

@ -230,34 +230,35 @@ body {
} }
div.pagination { div.pagination {
padding:3px; text-align:center;
margin:3px; padding:3px;
margin:3px;
} }
div.pagination a { div.pagination a {
padding: 2px 5px 2px 5px; padding: 2px 5px 2px 5px;
margin-right: 2px; margin-right: 2px;
border: 1px solid #ddd; border: 1px solid #ddd;
text-decoration: none; text-decoration: none;
color: #88AF3F; color: #aaa;
} }
div.pagination a:hover, div.pagination a:active { div.pagination a:hover, div.pagination a:active {
border:1px solid #85BD1E; padding: 2px 5px 2px 5px;
color: #638425; margin-right: 2px;
background-color: #F1FFD6; border: 1px solid #a0a0a0;
} }
div.pagination span.current { div.pagination span.current {
padding: 2px 5px 2px 5px; padding: 2px 5px 2px 5px;
margin-right: 2px; margin-right: 2px;
border: 1px solid #B2E05D; border: 1px solid #e0e0e0;
font-weight: bold; font-weight: bold;
background-color: #B2E05D; background-color: #f0f0f0;
color: #FFF; color: #aaa;
} }
div.pagination span.disabled { div.pagination span.disabled {
padding: 2px 5px 2px 5px; padding: 2px 5px 2px 5px;
margin-right: 2px; margin-right: 2px;
border: 1px solid #f3f3f3; border: 1px solid #f3f3f3;
color: #ccc; color: #ccc;
} }