Pagination and   Topic is solved

General project discussion. NOT for help questions.
Post Reply
b0n3m4n

Pagination and  

Post by b0n3m4n »

First I thought it might be a bug in the Guestbook module but now it could be a bug in cmsms.

\lib\classes\module_support\modmisc.inc.php has a function cms_module_CreatePagination which apparently creates a pagination browsing menu for all kinds of purposes.

What this function seems to be doing is to create a list of numbers, each linking to a certain page. These numbers are separated by a non breaking space ( ) which prevents line breaks and probably is supposed to enforce nicely looking one-lined paginations.

A problem occurs when the pagination has a huge number of entries, for example a Guestbook with 1000 entries. What happens in this case is that a forced one-liner pagination screws up the admin page.

So I would like to put this up for debate:

What good is a forced 1-liner pagination and wouldn't a pagination without  s be the way to go?

I'm sorry if I overlooked something, I have just started with cmsms and there is a lot that I don't know about the system yet.

Cheers,
Cerno
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Pagination and  

Post by calguy1000 »

The better solution would be to change the system from having links to individual pages
to having the 'first, prev, next, last' links.... then it wouldn't break anything and would work for unlimited pages.

I just haven't gotten to it yet.
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.
b0n3m4n

Re: Pagination and  

Post by b0n3m4n »

Yes, very nice.

I would add a dropbox for selection of a specific page so you wouldn't have to click your way to eternity.

I would like to start writing such an implementation if you don't mind but as I don't know much about cmsms would you be so kind and look over the implementation for flaws? I have never contributed to open source so I don't really know what I need to do to get the changes into the system (should they meet the quality standards).

Cerno
b0n3m4n

Re: Pagination and  

Post by b0n3m4n »

This should do the trick. Now for the dropbox I wonder if there is an elegant way to do it. I mean I could just add an html form and put some javascript in it so I won't need a "send"-button, but I assume there is an implementation for this kind of stuff already in cmsms, right?

Is the code correct like this? Seems to work.

Code: Select all

	if ($numofpages > 1)
	{
		if($page != 1)
		{
			$pagefirst = 1;
			$page_string .= $link.$pagefirst."\">"."<<"."</a> ";
			$pageprev = $page-1;
			$page_string .= $link.$pageprev."\">"."<"."</a> ";
		}
		else
		{
			$page_string .= "<<"." ";
			$page_string .= "<"." ";
		}

		$page_string .= lang('page')." ".$page." ";

		if (($totalrows - ($limit * $page)) > 0)
		{
			$pagenext = $page+1;
			$page_string .= $link.$pagenext."\">".">"."</a> ";
			$pagelast = $numofpages;
			$page_string .= $link.$pagelast."\">".">>"."</a>";
		}
		else
		{
			$page_string .= ">"." ";
			$page_string .= ">>";
		}
	}
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Pagination and  

Post by calguy1000 »

That looks close.

Now.... to submit patches to the core you need to:

a) checkout the cms made simple core package from svn:
      svn checkout http://svn.cmsmadesimple.org/svn/cmsmadesimple

b) make your changes
c) test
d) do an svn update again (just to be safe).
e) do an:
        svn diff "file I changed" > patch.diff
f) submit the patch in the cms made simple core tracker.
      http://dev.cmsmadesimple.org/tracker/?group_id=6
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.
Post Reply

Return to “General Discussion”