Hi Wishy
What tags should I use for the pagination markers (prev, next, total pages, etc).... couldn't find anything well marked in the style.css in the admin directory.
sorry, no IRC access at the office
Tags for pagination
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Tags for pagination
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Tags for pagination
new install of 7.3 and a fresh database... In the admin section on most links I get Fatal error: Call to undefined function: pagination() in /home/*****/public_html/admin/listgroups.php on line 33 
Any ideas anyone? I am stumped...
Thank you,
Shannon

Any ideas anyone? I am stumped...

Shannon
Solution for pagination
I changed implemetation of function pagination(..) in file 'page.functions.php' from
to
So, I can use this function like at file 'admin/adminlog.php', but (for example) with last parameter array('module=XY').
Caution for newbies: character '&' is added automatically.
Code: Select all
/**
* Creates a string containing links to all the pages.
* @param page - the current page to display
* @param totalrows - the amount of items being listed
* @param limit - the amount of items to list per page
* @return a string containing links to all the pages (ex. next 1,2 prev)
*/
function pagination($page, $totalrows, $limit)
{
$page_string = "";
$from = ($page * $limit) - $limit;
$numofpages = $totalrows / $limit;
if ($numofpages > 1)
{
if($page != 1)
{
$pageprev = $page-1;
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=$pageprev\">".lang('previous')."</a> ";
}
else
{
$page_string .= lang('previous')." ";
}
for($i = 1; $i <= $numofpages; $i++)
{
if($i == $page)
{
$page_string .= $i." ";
}
else
{
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
if(($totalrows % $limit) != 0)
{
if($i == $page)
{
$page_string .= $i." ";
}
else
{
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
if(($totalrows - ($limit * $page)) > 0)
{
$pagenext = $page+1;
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=$pagenext\">".lang('next')."</a>";
}
else
{
$page_string .= lang('next')." ";
}
}
return $page_string;
}
Code: Select all
/**
* Creates a string containing links to all the pages.
* @param page - the current page to display
* @param totalrows - the amount of items being listed
* @param limit - the amount of items to list per page
* @param params - additional params for href - array of strings
* @return a string containing links to all the pages (ex. next 1,2 prev)
*/
function pagination($page, $totalrows, $limit, $params="")
{
$added_params = "";
if (is_array($params)) {
foreach ($params as $param) {
$added_params .= "&".$param;
}
}
$page_string = "";
$from = ($page * $limit) - $limit;
$numofpages = $totalrows / $limit;
if ($numofpages > 1)
{
if($page != 1)
{
$pageprev = $page-1;
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".$pageprev.$added_params."\">".lang('previous')."</a> ";
}
else
{
$page_string .= lang('previous')." ";
}
for($i = 1; $i <= $numofpages; $i++)
{
if($i == $page)
{
$page_string .= $i." ";
}
else
{
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".$i.$added_params."\">$i</a> ";
}
}
if(($totalrows % $limit) != 0)
{
if($i == $page)
{
$page_string .= $i." ";
}
else
{
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".$i.$added_params."\">$i</a> ";
}
}
if(($totalrows - ($limit * $page)) > 0)
{
$pagenext = $page+1;
$page_string .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".$pagenext.$added_params."\">".lang('next')."</a>";
}
else
{
$page_string .= lang('next')." ";
}
}
return $page_string;
}
Caution for newbies: character '&' is added automatically.
Post scriptum
Of course, I speak ONLY about pagination in admin interface - if You want use this solution for pagination at Your webpages, You have to change parameter $config["query_var"] in file 'config.php' to another one


Re: Tags for pagination
hi,
how can i do this for pagination at my web pages then? i duno about php much. if you can help me w/example. i appreciate it.
thanks,
mo
how can i do this for pagination at my web pages then? i duno about php much. if you can help me w/example. i appreciate it.
thanks,
mo
Re: Tags for pagination
I think every PHP developer have his own way - whole problem is only about SQL statement SELECT and its part LIMIT. In case function 'pagination()' You are limited by it's parameter 'page', so if You have default install of CMSMS (no mod_rewrite, no changes in page variable), You can not use it in public interface.mo wrote: how can i do this for pagination at my web pages then?
I am using class SmartyPaginate in my Smarty-related projects, because this class is able to do almost all pagination-work for You (Your choice of pagination variable, possibility of more then one pagination bar at one page etc). For documentation, examples, demo and download see http://www.phpinsider.com/php/code/SmartyPaginate/.
Of course, if You do not like SmartyPaginate output for pagination, there is plenty of smarty variables of this class for creation Your own pagination bar - just read whole documentation of this class. IMHO it is very usable.
Last edited by 100rk on Mon Aug 08, 2005 9:51 am, edited 1 time in total.
Re: Tags for pagination
thank you.
oh man, this is too difficult for me—i'm just a designer and know basic html/css. i'm just trying to do my portfolio website w/CMS. which i have very little knowledge about. and all i wanna do is to make the News pages w/paging. too bad, i'm not a program developer:(
oh man, this is too difficult for me—i'm just a designer and know basic html/css. i'm just trying to do my portfolio website w/CMS. which i have very little knowledge about. and all i wanna do is to make the News pages w/paging. too bad, i'm not a program developer:(
Re: Tags for pagination
I am not pretty sure, what it meansmo wrote: all i wanna do is to make the News pages w/paging

And if You will combine this simple trick with user contributed plugin 'Improved version of cms_selflink' (download here: http://wiki.cmsmadesimple.org/tiki-inde ... ed+Plugins, forum topic here:http://forum.cmsmadesimple.org/index.ph ... 112.0.html), You will propably obtain almost all what You want - this plugin allows automatically create links 'previous page' and 'next page'.
Last edited by 100rk on Mon Aug 08, 2005 11:23 am, edited 1 time in total.