Das hier ist die Pagination-Funktion aus dem Pligg.
Weiß jemand von Euch, wo darin definiert wird, nach wieviel Beiträgen sie umbricht (man kann dies eigentlich im CMS einstellen)
Ich möchte gerne für jede Kategorie eine andere Anzahl haben. Das müsste man doch eigentlich mit if-Befehlen in PHP reinschreiben können oder ?
PHP-Code:
function do_pages($total, $page_size, $thepage, $fetch = false) {
// "previous" and "next" page buttons
global $db, $URLMethod, $main_smarty;
$index_limit = 10;
$current = get_current_page();
$total_pages=ceil($total/$page_size);
$start=max($current-intval($index_limit/2), 1);
$end=$start+$index_limit-1;
$output = '';
if ($URLMethod == 1) {
$query=preg_replace('/page=[0-9]+/', '', $_SERVER['QUERY_STRING']);
$query=preg_replace('/^&*(.*)&*$/', "$1", $query);
if(!empty($query)) $query = "&$query";
$output .= '<div class="pagination"><p>';
if($current==1) {
$output .= '<span class="pagesnonactive">« '.$main_smarty->get_config_vars("PLIGG_Visual_Page_Previous"). ' </span>';
} else {
$i = $current-1;
$output .= '<a href="?page='.$i.$query.'">« '.$main_smarty->get_config_vars("PLIGG_Visual_Page_Previous").'</a>';
}
if($start>1) {
$i = 1;
$output .= '<a href="?page='.$i.$query.'">'.$i.'</a>';
$output .= '<span>...</span>';
}
for ($i=$start;$i<=$end && $i<= $total_pages;$i++) {
if($i==$current) {
$output .= '<span class="pagescurrent">'.$i.'</span>';
} else {
$output .= '<a href="?page='.$i.$query.'" class="pages">'.$i.'</a>';
}
}
if($total_pages>$end) {
$i = $total_pages;
$output .= '<span>...</span>';
$output .= '<a href="?page='.$i.$query.'">'.$i.'</a>';
}
if($current<$total_pages) {
$i = $current+1;
$output .= '<a href="?page='.$i.$query.'"> '.$main_smarty->get_config_vars("PLIGG_Visual_Page_Next"). ' »' . '</a>';
} else {
$output .= '<span class="pagesnonactive"> '.$main_smarty->get_config_vars("PLIGG_Visual_Page_Next"). ' »' . '</span>';
}
$output .= "</p></div>\n";
}