This is replacement for the default
includes/paging.php that works exactly the same but could be used for anything, not only for images. (If u are not going to do your own changes in 4images code, then probably dont bother reading "How To Use" section )
-------- [ Installation ] -------- 1. Backup original
includes/paging.php 2. Download
this package.
3. Unpack and replace
includes/paging.php with the new one.
I added alternative way to show number of pages (
reference)
for that u'll need just change
$this->alt = 1; inside the file.
If u want show input form where visitor can manualy enter the page number they want to see, change these lines in the file:
$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.
--------- [ How To Use ] ----------I'll try explain it by an example :
$cat_num_all = 10;
$cat_perpage = 4;
$cat_page = 2;
$link_arg = $site_sess->url(ROOT_PATH."categories.php");
$text = "Found {total_cat_images} categories(s) on {total_pages} page(s) .Displayed: category {first_page} to {last_page}.";
$page_text = "cat_page";
$extra = "categories";
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($cat_page, $cat_perpage, $cat_num_all, $link_arg, $text, $page_text, $extra);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"cat_paging" => $getpaging->get_paging(),
"cat_paging_stats" => $getpaging->get_paging_stats()
));
this is not working example, so dont bother trying it if u are familuar a little bit with 4images code, then u might see, that all this is almost the same as the default, exept three new variables that being send to
Paging class:
$getpaging = new Paging($cat_page, $cat_perpage, $cat_num_all, $link_arg, $text, $page_text, $extra, $style); if u leave those variables empty (or just wont add them to the code), paging will use the default settings.
In
$text variable u can specify text that u'd like to show in the templates by
{cat_paging_stats} U can use the same {..} tags as in $lang['paging_stats'] in your /lang/<yourlanguage>/main.php
In
$page_text u can specify name of "page" for the link address. In this example it will change current page when in the address add
cat_page=XX . If u leave it empty it will generate links to the pages by using
page=XX. This is neccery if u want use more then one paging at the same page, for example if u want add paging for list of categories and still have paging for images.
$extra needs only if u want after open "next" page it "jumps" to the part of page, name of witch matching with $extra. $extra will be added into "pages" link as #$extra.
in this example the link would be:
categories.php?cat_page=XX#categories
$style set style of paging displayed. If not set, will use
class="paginginput" and
class="pagingbutton"You can either replace in style.css:
.button {
with:
.button, .pagingbutton {
and
.logininput {
with
.logininput, .paginginput {
or add in style.css something like this:
.paginginput {
background-color: #ffffff;
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
color: #0f5475;
font-size: 11px;
}
.pagingbutton {
font-family: Tahoma,Verdana,Arial, Helvetica, sans-serif;
background-color: #003366;
color: #fcdc43;
font-size: 11px;
font-weight: bold;
}
-------- [ Version history ] -------- 1.1.2 (2010-12-08)
- applied bug fix:
[1.7 - 1.7.9] Security fix for path disclosure in paging.php1.1.1 (2010-09-06)
- it's now PHP5 compatible
1.1 - Added optional "manual input form" feature
1.0 - First release