DEFAULT PAGINATION:
When a member does a search on your site, the default pagination shows up below the search results. The problem is, members will get caught up looking at the pictures and forget the page number they are on. Nor is there a Next or Previous button to guide them.
My members wanted a better way, so the following guidelines came from Ramil's Pagination Mod.
DOWNLOAD FILES
To change the default pagination we need to download a file to upload. The download link is:
http://www.filipina-lady.net/test253/ext.upgn.zip
(note: if you downloaded ext.upgn.php from vldForum, this is an updated version you would need for this mod)
Unzip the folder you downloaded and inside you will find the source file:
- ext.upgn.php
Upload ext.upgn.php to includes/ext folder.
CHANGES TO LIB FILES
In include/lib folder make the following changes to lib files.
OPEN lib.pictures.php FIND:
//------------------------------------------------
// Assign misc values
//------------------------------------------------
$TEMPLATE->assign("global_pictures", $pictures_obj);
$TEMPLATE->assign("total_pages", $totalpages);
$TEMPLATE->assign("pages_info", $pages);
$TEMPLATE->assign("current_page", $page);
$TEMPLATE->assign("previous_page", $previous_page);
$TEMPLATE->assign("previous_page_link", $previous_page_link);
$TEMPLATE->assign("next_page", $next_page);
$TEMPLATE->assign("next_page_link", $next_page_link);
$TEMPLATE->assign("total_pages", $totalpages);
$TEMPLATE->assign("total_pictures", $totalpictures);
$TEMPLATE->assign("page_links", $page_links);
AFTER $TEMPLATE->assign("page_links", $page_links); ADD:
$TEMPLATE->assign("hash", ($hash ? $hash : '') );
$TEMPLATE->assign("order_by", $orderby);
$TEMPLATE->assign("order_dir", $direction);
OPEN lib.blogs.php FIND:
//------------------------------------------------
// Assign values
//------------------------------------------------
$TEMPLATE->assign("total_entries", $totalentries);
$TEMPLATE->assign("globalblogs_entries", $entries_obj);
$TEMPLATE->assign("pages_info", $pages);
$TEMPLATE->assign("previous_page", $previous_page);
$TEMPLATE->assign("next_page", $next_page);
$TEMPLATE->assign("previous_page_link", $previous_page_link);
$TEMPLATE->assign("next_page_link", $next_page_link);
$TEMPLATE->assign("total_pages", $totalpages);
$TEMPLATE->assign("page_links", $page_links);
$TEMPLATE->assign("current_page", $page);
AFTER $TEMPLATE->assign("current_page", $page); ADD:
$TEMPLATE->assign("hash", ($hash ? $hash : '') );
$TEMPLATE->assign("order_by", $orderby);
$TEMPLATE->assign("order_dir", $direction);
OPEN lib.videos.php FIND:
//------------------------------------------------
// Assign misc values
//------------------------------------------------
$TEMPLATE->assign("global_videos", $videos_obj);
$TEMPLATE->assign("total_pages", $totalpages);
$TEMPLATE->assign("pages_info", $pages);
$TEMPLATE->assign("current_page", $page);
$TEMPLATE->assign("previous_page", $previous_page);
$TEMPLATE->assign("previous_page_link", $previous_page_link);
$TEMPLATE->assign("next_page", $next_page);
$TEMPLATE->assign("next_page_link", $next_page_link);
$TEMPLATE->assign("total_pages", $totalpages);
$TEMPLATE->assign("total_videos", $totalvideos);
$TEMPLATE->assign("page_links", $page_links);
AFTER $TEMPLATE->assign("page_links", $page_links); ADD:
$TEMPLATE->assign("hash", ($hash ? $hash : '') );
$TEMPLATE->assign("order_by", $orderby);
$TEMPLATE->assign("order_dir", $direction);
LANGUAGE
You need to add the following to lang.core.php file in the includes/languages/your language folder.
"next_page" =>
"Next page",
"previous_page" =>
"Previous page",
"first_page" =>
"First page",
"last_page" =>
"Last page",
STYLING
Depending on your preference you will add one of the following styles to your template site.css.
CLEAN STYLE
/* ------------- Pagination: Clean ------------ */
/* -------------------------------------------- */
#pagination-clean li { border:0; margin:0; padding:0; font-size:11px; list-style:none; /* savers */ float:left; }
/* savers #pagination-clean li,*/
#pagination-clean a { border-right:solid 1px #DEDEDE; margin-right:2px; }
#pagination-clean .previous-off,
#pagination-clean .next-off { color:#888888; display:block; float:left; font-weight:bold; padding:3px 4px; }
#pagination-clean .next a,
#pagination-clean previous a { border:none; font-weight:bold; }
#pagination-clean .active { color:#000000; font-weight:bold; display:block; float:left; padding:4px 6px; /* savers */ border-right:solid 1px #DEDEDE; }
#pagination-clean a:link,
#pagination-clean a:visited { color:#0e509e; display:block; float:left; padding:3px 6px; text-decoration:underline; }
#pagination-clean a:hover { text-decoration:none; }
DIGG STYLE
/* ----------- Pagination: Digg Style --------- */
/* -------------------------------------------- */
#pagination-digg li { border:0; margin:0; padding:0; font-size:11px; list-style:none; /* savers */ float:left; }
#pagination-digg a { border:solid 1px #9aafe5; margin-right:2px; }
#pagination-digg .previous-off,
#pagination-digg .next-off { border:solid 1px #DEDEDE; color:#888888; display:block; float:left; font-weight:bold; margin-right:2px; padding:3px 4px; }
#pagination-digg .next a,
#pagination-digg .previous a { font-weight:bold; }
#pagination-digg .active { background:#2e6ab1; color:#FFFFFF; font-weight:bold; display:block; float:left; padding:4px 6px; /* savers */ margin-right:2px; }
#pagination-digg a:link,
#pagination-digg a:visited { color:#0e509e; display:block; float:left; padding:3px 6px; text-decoration:none; }
#pagination-digg a:hover { border:solid 1px #0e509e; }
SEARCH_RESULTS.TPL
First, we will focus on the template search_results.tpl. Depending on the style you added to site.css, you need to make some changes to ext.upgn.php file.
CODING FOR CLEAN STYLE
OPEN ext.upgn FIND:
$output = "<ul id=\"pagination\">";
CHANGE TO:
$output = "<ul id=\"pagination-clean\">";
IN YOUR TEMPLATE OPEN search_results.tpl FIND
<div class="footer">
<p>{lang:"pictures","page_numbers"}</p>
{page_links}
<div class="clear"></div>
</div>
CHANGE {page_links} TO THE FOLLOWING CALL:
{upgn:tp=total_pages,pn=page_number,hs=search_hash}
CODING FOR DIGG STYLE
If you want to use DIGG style, add the appropriate CSS code to site.css and make the appropriate change in ext.upgn for that style.
$output = "<ul id=\"pagination-digg\">";
Use the same call as above in search_results.tpl to replace {page_links}
DIGG style looks like:
TEMPLATE CALLS FOR PICTURES.TPL, VIDEOS.TPL AND BLOGS.TPL
So far the only template we made changes to was search_results.tpl. For pictures.tpl, videos.tpl and blogs.tpl, the same instructions apply that were used for search_results.tpl except you use a different CALL. Use the following CALL to replace {page_links} in each template.
{upgn:tp=total_pages,pn=current_page,hs=hash,orderby=order_by,orderdir=order_dir}





Comments
desperatesailors
richardsut
db3204
radioact
Log in to leave a comment