Changeset 363 for global.php
- Timestamp:
- May 21, 2008, 8:01:32 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
global.php
r358 r363 245 245 246 246 // Zobrazení èíselný seznamu stránek 247 function PagesList($URL,$Page,$TotalCount,$CountPerPage) 248 { 249 $Count = ceil($TotalCount/$CountPerPage); 250 $Around = 10; 247 function PagesList($URL, $Page, $TotalCount, $CountPerPage, $Around = 10) 248 { 249 $Count = ceil($TotalCount / $CountPerPage); 251 250 $Result = ''; 252 if($Count >1)253 { 254 if($Page >0)255 { 256 $Result .= '<a href="'.$URL.'0"><<</a> ';257 $Result .= '<a href="'.$URL.($Page-1).'"><</a> ';258 } 259 $PagesMax = $Count -1;251 if($Count > 1) 252 { 253 if($Page > 0) 254 { 255 $Result .= '<a href="'.$URL.'0"><<</a> '; 256 $Result .= '<a href="'.$URL.($Page-1).'"><</a> '; 257 } 258 $PagesMax = $Count - 1; 260 259 $PagesMin = 0; 261 if($PagesMax >($Page+$Around)) $PagesMax = $Page+$Around;262 if($PagesMin <($Page-$Around))260 if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around; 261 if($PagesMin < ($Page - $Around)) 263 262 { 264 263 $Result.= ' .. '; 265 $PagesMin = $Page -$Around;266 } 267 for($i =$PagesMin;$i<=$PagesMax;$i++)268 { 269 if($i ==$Page) $Result.= '<strong>';270 $Result .= '<a href="'.$URL.$i.'">'.($i+1).'</a> ';271 if($i ==$Page) $Result.= '</strong>';264 $PagesMin = $Page - $Around; 265 } 266 for($i = $PagesMin; $i <= $PagesMax; $i++) 267 { 268 if($i == $Page) $Result .= '<strong>'; 269 $Result .= '<a href="'.$URL.$i.'">'.($i + 1).'</a> '; 270 if($i == $Page) $Result .= '</strong>'; 272 271 } 273 if($PagesMax <($Count-1)) $Result .= ' .. ';274 if($Page <($Count-1))275 { 276 $Result .= '<a href="'.$URL.($Page+1).'">></a> ';277 $Result .= '<a href="'.$URL.($Count-1).'">>></a>';272 if($PagesMax < ($Count - 1)) $Result .= ' .. '; 273 if($Page < ($Count - 1)) 274 { 275 $Result .= '<a href="'.$URL.($Page + 1).'">></a> '; 276 $Result .= '<a href="'.$URL.($Count - 1).'">>></a>'; 278 277 } 279 278 }
Note:
See TracChangeset
for help on using the changeset viewer.