WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R24 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Paging
  • Print
Pages: [1]   Go Down

Author Topic: Paging  (Read 6323 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

Logged

Offline Bug

  • Posts: 237
Re: Paging
« Reply #1 on: May 08, 2011, 05:14:53 PM »
Something like this would be fantastic

http://plugins.jquery.com/project/pagination

http://www.phpeasystep.com/phptu/29.html
« Last Edit: May 09, 2011, 07:33:18 PM by Bug »
Logged

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> ';
}

Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Paging
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2