Author Topic: [MOD] Universal Paging Class v1.1.2  (Read 76220 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Universal Paging Class v1.1
« Reply #15 on: September 30, 2006, 07:51:05 PM »
file attached.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #16 on: October 01, 2006, 01:42:58 PM »
Thanks a lot V@no!! :)

Offline Neo777

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #17 on: January 17, 2007, 11:14:27 PM »
The download-link is dead.

How can I now get the file?

greetings

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #18 on: January 17, 2007, 11:23:54 PM »
@ Neo777
... use the download-link from the bottom of the first post ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Neo777

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #19 on: January 17, 2007, 11:32:30 PM »
Thanks!

I was just blind. Sorry  :cry:

Offline Tino23

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • LMJ - Motorsport
Re: [MOD] Universal Paging Class v1.1
« Reply #20 on: October 27, 2007, 04:54:15 PM »
Zusätzlich müssen aber noch zwei Einträge in der style.css gemacht werden!

.pagingbutton {
  font-family:  Tahoma,Verdana,Arial, Helvetica, sans-serif;
  background-color: #deine Farbe;
  color: #deine Farbe;
  font-size: 11px;
  font-weight: bold;
}

.paginginput{
 font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  color: #deine Farbe;
  font-size: 11px;
}

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #21 on: February 29, 2008, 05:13:38 AM »
I edit paging class for ACP. ;)

// Step 1

1 - In admin folder - create new folder: includes (no edit CHMOD :!:)
2 - In admin/includes - create new file: admin_paging.php .

Add:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *


 *             File: paging.php                                           *
 *     File Version: 1.1.2                                                *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *

 *    Scriptversion: 1.7.9                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH'))
{
  die(
"Security violation");
}
if (!
class_exists("Paging"))
{
  class 
Paging
  
{
    var 
$page,$page1,$offset,$perpage,$num_rows_all,$link_args;
    var 
$first,$last,$total_pages,$config,$desc,$next,$back,$extra,$query,$form,$formjs;

//    function Paging($page = 1, $perpage = 0, $num_rows_all = 0, $link_args = "", $text = "", $extra = "", $page_text = "", $style = "", $page1 = 0, $form = false, $formjs = false)
    
function Paging($page 1$perpage 0$num_rows_all 0$link_args ""$text ""$extra ""$page_text ""$style ""$page1 0$form true$formjs true)
    {
      global 
$lang$config;

  
//-------- Config ------------
  //Change $this->alt to 1 if u want display number of pages not more then u set in the settings, no metter on witch page u are.
  //by default if u have 20 pages, for example, and in the settings set to show only 10, it will actualy show u 20 pages when u go to 10th page.
      
$this->alt 1;
      
$this->form $form//(true, false or $form) - show the form where visitor can manualy enter the page they want to enter.
      
$this->formjs $formjs//(true, false or $formjs) - include JS input validation, to ensure that the entered page is valid.
  //------- End Config ---------

      
if (!isset($lang['gotopage'])) $lang['gotopage'] = "Go to page:";
      if (!isset(
$lang['pagebutton'])) $lang['pagebutton'] = "Go";
  
/*
      if (!isset($lang['gotopage'])) $lang['gotopage'] = "";
      if (!isset($lang['pagebutton'])) $lang['pagebutton'] = "Go to page";
  */
      
$this->style = ($style) ? $style "paging";
      
$this->extra = ($extra) ? "#".$extra "";
      
$this->page_text = ($page_text) ? $page_text "page";
      
$this->desc = ($text) ? $text $lang['paging_stats'];

      
$this->page = (int)$page;
      
$this->perpage = (int)$perpage;
      
$this->num_rows_all = (int)$num_rows_all;

      
  if ($this->page <= 0)
      {
        
$this->page 1;
      }
      if (
$this->perpage <= 0)
      {
        
$this->perpage 1;
      }
     
      if (!
$this->num_rows_all)
      {
        
$this->total_pages 0;
      }
      elseif (
$this->num_rows_all <= $this->perpage)
      {
        
$this->total_pages 1;
      }
      elseif (
$this->num_rows_all $this->perpage == 0)
      {
        
$this->total_pages $this->num_rows_all $this->perpage;
      }
      else
      {
        
$this->total_pages ceil($this->num_rows_all $this->perpage);
      }

      if (
$this->page $this->total_pages)
      {
        
$this->page 1;
      }

      if (!
$this->num_rows_all)
      {
        
$this->first 0;
      }
      else
      {
        
$this->first $this->perpage $this->page $this->perpage 1;
      }

      if (!
$this->num_rows_all)
      {
        
$this->last 0;
      }
      elseif (
$this->page == $this->total_pages)
      {
        
$this->last $this->num_rows_all;
      }
      else
      {
        
$this->last $this->perpage $this->page;
      }

      
$this->offset $this->perpage $this->page $this->perpage;

      
$link_args preg_replace("/&".$this->page_text."=[0-9]*/"""$link_args);
      
$link_args preg_replace("/".$this->page_text."=[0-9]*&/"""$link_args);
      
$this->link_args basename($link_args);
      
$query "";
      if (
strpos($this->link_args'?') !== false)
      {
        if (
$this->form)
        {
          
$query substr(strrchr($this->link_args,"?"), 1);
        }
        
$this->link_args .= "&amp;";
      }
      else
      {
        
$this->link_args .= "?";
      }
      if (
$query)
      {
        
$query explode("&"str_replace("&amp;""&"$query));
        foreach (
$query as $key)
        {
          if (
$val substr(strrchr($key,"="), 1))
          {
            
$name substr($key,0,(strlen($key)-strlen(strrchr($key,"="))));
          }
          else
          {
            
$name $key;
          }
          
$this->query .= "<input type=\"hidden\" name=\"".$name."\" value=\"".$val."\">\n";
        }
      }

      
$this->paging_next $lang['paging_next'];
      
$this->paging_back $lang['paging_previous'];
      
$this->paging_lastpage $lang['paging_lastpage'];
      
$this->paging_firstpage $lang['paging_firstpage'];
      
$this->range $config['paging_range'];
    }

    function 
get_paging()
    {
      
$html "";
      if (
$this->total_pages 1)
      {
        
$page_back $this->page 1;
        
$page_next $this->page 1;
        if (
$this->form)
        {
          
$js = ($this->formjs) ? " onSubmit=\"if (!page.value || page.value < 1 || page.value > ".$this->total_pages.") return false;\"" "";
          
$html .= "<form action=\"".substr($this->link_args,0,(strlen($this->link_args)-strlen(strrchr($this->link_args,"?"))))."\" method=\"GET\"$js style=\"margin:0px;\"/>\n".$this->query;
        }
        if (
$this->alt)
        {
          if (
$page_back 0)
          {
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=1".$this->extra."\" class=\"".$this->style."\">".$this->paging_firstpage."</a>&nbsp;&nbsp;";
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_back.$this->extra."\" class=\"".$this->style."\">".$this->paging_back."</a>&nbsp;&nbsp;";
          }
          
$page_num2 ceil($this->range 2);
          
$page_num3 $this->range;
          
$page_left 1;
          if ((
$this->page $page_num2) > 0)
          {
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".(($this->page $this->range $page_num2) ? $page_num2 : (($this->page <= ($this->total_pages $page_num2)) ? $this->page $this->range $this->total_pages $this->range $page_num2 1)).$this->extra."\" class=\"".$this->style."\">...</a>&nbsp;&nbsp;";
          }
          for (
$page_num 1$page_num <= $this->total_pages$page_num++){
            if (
$page_num3)
            {
              if (
$page_left)
              {
                if ((
$page_num >= $this->page - ($this->range $page_num2)) || ($page_num $this->total_pages $this->range && $this->page $this->total_pages $this->range ))
                {
                  if (
$this->page == $page_num)
                  {
                    
$page_left--;
                    
$page_num2--;
                    
$page_num3--;
                    
$html .= "[<b class=\"".$this->style."on\">".$page_num."</b>]&nbsp;&nbsp;";
                  }
                  else
                  {
                    
$page_num2--;
                    
$page_num3--;
                    
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_num.$this->extra."\" class=\"".$this->style."\">".$page_num."</a>&nbsp;&nbsp;";
                  }
                }
              }
              else
              {
              if (
$page_num <= $this->page + ($this->range $page_num2))
              {

                  if (
$this->page == $page_num)
                  {
                    
$html .= "[<b class=\"".$this->style."on\">".$page_num."</b>]&nbsp;&nbsp;";
                  }
                  else
                  {
                    
$page_num2--;
                    
$page_num3--;
                    
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_num.$this->extra."\" class=\"".$this->style."\">".$page_num."</a>&nbsp;&nbsp;";
                  }
                }
              }
            }
          }
          
$page_num2 ceil($this->range 2);
          if ((
$this->page $page_num2) <= $this->total_pages)
{
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".(($this->page $page_num2 <= $this->total_pages $this->range) ? (($this->page $page_num2) ? $this->range $page_num2 $this->page $this->range) : $this->total_pages $page_num2 1).$this->extra."\" class=\"".$this->style."\">...</a>&nbsp;&nbsp;";
          }
          if (
$page_next <= $this->total_pages)
{
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_next.$this->extra."\" class=\"".$this->style."\">".$this->paging_next."</a>&nbsp;&nbsp;";
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$this->total_pages.$this->extra."\" class=\"".$this->style."\">".$this->paging_lastpage."</a>";
          }
        }
        else
        {
          if (
$page_back 0)
          {
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=1".$this->extra."\" class=\"".$this->style."\">".$this->paging_firstpage."</a>&nbsp;&nbsp;";
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_back.$this->extra."\" class=\"".$this->style."\">".$this->paging_back."</a>&nbsp;&nbsp;";
          }
          for (
$page_num 1$page_num <= $this->total_pages$page_num++)
          {
            if (
$page_num >= ($this->page $this->range) && $page_num <= ($this->page $this->range))
            {
              if (
$this->page == $page_num)
              {
                
$html .= "<b class=\"".$this->style."on\">".$page_num."</b>&nbsp;&nbsp;";
              }
              else
              {
                
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_num.$this->extra."\" class=\"".$this->style."\">".$page_num."</a>&nbsp;&nbsp;";
              }
            }
          }
          if (
$page_next <= $this->total_pages)
          {
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$page_next.$this->extra."\" class=\"".$this->style."\">".$this->paging_next."</a>&nbsp;&nbsp;";
            
$html .= "<a href=\"".$this->link_args.$this->page_text."=".$this->total_pages.$this->extra."\" class=\"".$this->style."\">".$this->paging_lastpage."</a>";
          }
        }
        if (
$this->form)
        {
          global 
$lang;
          
$html .= "&nbsp;".$lang['gotopage']."&nbsp;<input type=\"text\" size=\"2\" name=\"page\" value=\"\" class=\"paginginput\" />\n<input type=\"submit\" value=\"".$lang['pagebutton']."\" class=\"pagingbutton\" />\n</form>";
        }
      }
      return 
$html;
    }

    function 
get_offset()
    {
      return 
$this->offset;
    }

    function 
get_paging_stats()
    
{      

      
$search_array = array(
        
"{total_cat_images}",
        
"{total_pages}",
        
"{first_page}",
        
"{last_page}"
      
);
      
$replace_array = array(
        
$this->num_rows_all,
        
$this->total_pages,
        
$this->first,
        
$this->last
      
);
      
$this->desc str_replace($search_array$replace_array$this->desc);
      return 
$this->desc;
    }
  } 
//end of class
}
?>

« Last Edit: March 26, 2011, 03:45:28 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [MOD] Universal Paging Class v1.1
« Reply #22 on: March 09, 2008, 10:16:45 PM »
Hello V@no and others!
I must say: it's perfect forum!!! I had found here many useful mods and installed them without any problems. All was so clearly!
Thanks a lot for your great work!

P.S. sorry for my English

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #23 on: March 10, 2008, 10:18:23 AM »
hello alekinna,

thank you for your statement in name for V@no because he was not online since november 2006
we do not know what happend to him :(
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [MOD] Universal Paging Class v1.1
« Reply #24 on: March 10, 2008, 11:54:09 AM »
I belive he is all right! I saw him active in the internet.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #25 on: March 10, 2008, 11:59:07 AM »
huuuuuuuuuuuuuuuuuuuuuh...

where did you saw it that he is active?
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Re: [MOD] Universal Paging Class v1.1
« Reply #26 on: March 19, 2008, 06:43:31 PM »
yes mis him so much

Offline rockboy_62

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #27 on: June 04, 2008, 09:41:31 AM »
i want use this mod in the home page.possible?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #28 on: June 04, 2008, 01:23:42 PM »
@rockboy_62

... I think you need paging on home/index page only if you want to show e.g. all new images ...
... if so, it is possible and there is a MOD for this ...
... if not so, I have no clue for what you need paging on home/index page ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [MOD] Universal Paging Class v1.1
« Reply #29 on: October 01, 2008, 03:31:56 PM »
Sorry, aber ich habe das nicht so richtig verstanden!
Was genau bewirkt diese modifikation?