Browse Source

New pagination style and url_friendly on pagination

pecesama 18 years ago
parent
commit
4b0fc4bf0d
2 changed files with 39 additions and 25 deletions
  1. 17 4
      index.php
  2. 22 21
      themes/tumblr/style.css

+ 17 - 4
index.php View File

26
 		$id_post = $_GET["post"];
26
 		$id_post = $_GET["post"];
27
 	} else {
27
 	} else {
28
 		if (isset($param_url[1]) && $param_url[1]=="post") {
28
 		if (isset($param_url[1]) && $param_url[1]=="post") {
29
-			$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
29
+			$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
30
+		} else {
31
+			$id_post = NULL;
32
+		}
33
+	}
34
+	
35
+	if (isset($_GET["page"])) {
36
+		$page_num = $_GET["page"];
37
+	} else {
38
+		if (isset($param_url[1]) && $param_url[1]=="page") {
39
+			$page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
40
+		} else {
41
+			$page_num = NULL;
30
 		}
42
 		}
31
 	}
43
 	}
32
 	
44
 	
40
 
52
 
41
 		$limit=$conf->postLimit;
53
 		$limit=$conf->postLimit;
42
 	
54
 	
43
-		if(isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page']>0) { // Is defined the page and is numeric?
44
-			$from = (($_GET['page']-1) * $limit);
55
+		if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
56
+			$from = (($page_num-1) * $limit);
45
 		} else {
57
 		} else {
46
 			$from = 0;
58
 			$from = 0;
47
 		}
59
 		}
105
 				}
117
 				}
106
 			}
118
 			}
107
 
119
 
108
-			echo pagination($tumble->getPostsNumber(), $limit, isset($_GET['page']) ? $_GET['page'] : 1, "index.php", 2); // Shows the pagination
120
+			echo pagination($tumble->getPostsNumber(), $limit, isset($page_num) ? $page_num : 1, array($conf->urlGelato."/index.php/page/[...]/","[...]"), 2);
121
+
109
 
122
 
110
 		} else {
123
 		} else {
111
 			$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
124
 			$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");

+ 22 - 21
themes/tumblr/style.css View File

230
 	        }
230
 	        }
231
 			
231
 			
232
 div.pagination {
232
 div.pagination {
233
-	padding:3px;
234
-	margin:3px;
233
+text-align:center;
234
+padding:3px;
235
+margin:3px;
235
 }
236
 }
236
 
237
 
237
 div.pagination a {
238
 div.pagination a {
238
-	padding: 2px 5px 2px 5px;
239
-	margin-right: 2px;
240
-	border: 1px solid #ddd;
241
-	
242
-	text-decoration: none; 
243
-	color: #88AF3F;
239
+padding: 2px 5px 2px 5px;
240
+margin-right: 2px;
241
+border: 1px solid #ddd;
242
+
243
+text-decoration: none;
244
+color: #aaa;
244
 }
245
 }
245
 div.pagination a:hover, div.pagination a:active {
246
 div.pagination a:hover, div.pagination a:active {
246
-	border:1px solid #85BD1E;
247
-	color: #638425;
248
-	background-color: #F1FFD6;
247
+padding: 2px 5px 2px 5px;
248
+margin-right: 2px;
249
+border: 1px solid #a0a0a0;
249
 }
250
 }
250
 div.pagination span.current {
251
 div.pagination span.current {
251
-	padding: 2px 5px 2px 5px;
252
-	margin-right: 2px;
253
-	border: 1px solid #B2E05D;
254
-	font-weight: bold;
255
-	background-color: #B2E05D;
256
-	color: #FFF;
252
+padding: 2px 5px 2px 5px;
253
+margin-right: 2px;
254
+border: 1px solid #e0e0e0;
255
+font-weight: bold;
256
+background-color: #f0f0f0;
257
+color: #aaa;
257
 }
258
 }
258
 div.pagination span.disabled {
259
 div.pagination span.disabled {
259
-	padding: 2px 5px 2px 5px;
260
-	margin-right: 2px;
261
-	border: 1px solid #f3f3f3;
262
-	color: #ccc;
260
+padding: 2px 5px 2px 5px;
261
+margin-right: 2px;
262
+border: 1px solid #f3f3f3;
263
+color: #ccc;
263
 }
264
 }