Author Topic: Paging  (Read 2150 times)

Offline Bug

  • Posts: 237
Paging
« on: May 08, 2011, 12:40:28 PM »
How it now is:

Only links to next and previous page


But can it be:

[ 1 ]  [ 2 ]  [ 3 ]  etc


Offline Bug

  • Posts: 237
Re: Paging
« Reply #1 on: May 08, 2011, 05:14:53 PM »
« Last Edit: May 09, 2011, 07:33:18 PM by Bug »

Offline Bug

  • Posts: 237
Re: Paging
« Reply #2 on: May 11, 2011, 05:00:37 PM »
did it like this

in view_overview, just below the code that creates the next and previous links i added

Code: [Select]
$firstpage = '0';





if ($total_num > $setting_items_per_page){

if ($position == '0'){
echo '<div class="page_on"><a href="?p='.($firstpage).'">1</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($firstpage).'">1</a></div> ';
}

}



if ($total_num > $setting_items_per_page){

if ($position == $setting_items_per_page){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page).'">2</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page).'">2</a></div> ';
}

}


if ($total_num > $setting_items_per_page*2){

if ($position == $setting_items_per_page*2){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page*2).'">3</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page*2).'">3</a></div> ';
}

}
if ($total_num > $setting_items_per_page*3){

if ($position == $setting_items_per_page*3){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page*3).'">4</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page*3).'">4</a></div> ';
}

}
if ($total_num > $setting_items_per_page*4){

if ($position == $setting_items_per_page*4){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page*4).'">5</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page*4).'">5</a></div> ';
}

}
if ($total_num > $setting_items_per_page*5){

if ($position == $setting_items_per_page*5){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page*5).'">6</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page*5).'">6</a></div> ';
}

in the frontend.css i added

Code: [Select]
.page_on {
background:#0f7192;
width:18px;
height:18px;
color:#ffffff;
text-align:center;
float:left;
margin-right:4px;
}

.page_on a {
background:#0f7192;
width:18px;
height:18px;
color:#ffffff;
text-align:center;
float:left;
}

.page_on a:hover {
background:#7ab4c8;
width:18px;
height:18px;
color:#ffffff;
text-align:center;
float:left;
}

.page_off {
background:#cccccc;
width:18px;
height:18px;
color:#0f7192;
text-align:center;
float:left;
margin-right:4px;

}

.page_off a {
background:#cccccc;
width:18px;
height:18px;
color:#0f7192;
text-align:center;
float:left;
}

.page_off a:hover {
background:#0f7192;
width:18px;
height:18px;
color:#ffffff;
text-align:center;
float:left;
}

it looks way nicer than the original pagination..

the con is that it does not automatically add page-numbers,
from this example: if you need more than 5 pages you have to add extra code

the script does see if the page exists so there will not be any dead links from the pagina ...

- - - -

Is there anyone that knows how to automate the generation of the

Code: [Select]
if ($total_num > $setting_items_per_page*2){

if ($position == $setting_items_per_page*2){
echo '<div class="page_on"><a href="?p='.($setting_items_per_page*2).'">3</a></div> ';
}else{
echo '<div class="page_off"><a href="?p='.($setting_items_per_page*2).'">3</a></div> ';
}