Sep 07, 2008, 01:49 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Donate to MODx: Donations
Pages: [1] 2   Go Down
  Print  
Author Topic: [Tutorial] Pagination  (Read 9174 times)
0 Members and 1 Guest are viewing this topic.
chrisandy
Full Member
***
Posts: 153


WWW
« on: Feb 20, 2007, 06:26 AM »

First of all many thanks to you guys for pointing me in the right direction time after time - my testing is going extremely well - I'm very optimistic and very impressed.

How can I paginate the results in Ditto so that only a certain number of results are returned per page and I can use the 'previous' and 'next' options?

Thanks again
« Last Edit: Feb 26, 2007, 07:08 PM by Mark » Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #1 on: Feb 20, 2007, 09:08 AM »

Assuming you are using Ditto 2:

&summarize = number of results per page
&paginate = 1
&paginateAlwaysShowLinks= 1

Then add this after the Ditto call:

Code:
<p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles | Page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong></p> <div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div> </div>

And here is some example CSS to get you started:
Code:
.ditto_paging {
    border-top: 1px solid #ccc;
    padding: 10px;
    font-size: 86%;
    color: black;
}
#ditto_pages .ditto_currentpage {
    border: 1px solid black;
    padding: 1px 5px 2px;
    margin-right: 1px;
    background-color: #008CBA;
    color: #fff;
}
#ditto_pages .ditto_off {
    border: 1px solid #ccc;
    padding: 1px 5px 2px;
    margin-right: 1px;
    color: #ccc;
}
#ditto_pages a, #ditto_pages a:link, #ditto_pages a:visited {
    border: 1px solid #008CBA;
    padding: 1px 5px 2px;
    margin-right: 1px;
    text-decoration: none !important;
    color: black;
}
#ditto_pages a:hover {
    background-color: #fff;
    color: #000;
}

Updated: Added example CSS.
« Last Edit: Mar 17, 2007, 03:57 PM by Mark » Logged

chrisandy
Full Member
***
Posts: 153


WWW
« Reply #2 on: Feb 20, 2007, 12:50 PM »

Thank you - worked a treat
Logged
yentsun
MODx Russia
Moderators
*
Posts: 514



WWW
« Reply #3 on: Apr 14, 2007, 04:51 PM »

I'd like to know how to use pagination with multiple ditto calls on a page. And how the "id" parameter deals with [+pages+] placeholder.
In this call
Code:
[!Ditto? &id=`blog` &startID=`39,40,80` &tpl=`ditto_news` &sortBy=`createdon` &summarize=`7` &dateFormat=`%d.%m.%Y` &truncText=`далее...` &paginate=`1`!]
<div id="pagination"><span>Стр.:</span> [+pages+]</div>
no pages are displayed.

[Solved] When you set the "id" parameter, you should prefix the corresponding pagination placeholder with that id.
Example: [[Ditto? ... &id=`main` ...]]
[+main_pages+]
« Last Edit: Apr 15, 2007, 02:50 AM by Mark » Logged

http://modx.ru - российская поддержка MODx
http://modxnotes.blogspot.com/ - личный блог по MODx
SamZ
Sr. Member
****
Posts: 397


всегда ищу работу :-)


WWW
« Reply #4 on: May 19, 2007, 12:47 PM »

I'd like to know how to use pagination with multiple ditto calls on a page. And how the "id" parameter deals with [+pages+] placeholder.
In this call
Code:
[!Ditto? &id=`blog` &startID=`39,40,80` &tpl=`ditto_news` &sortBy=`createdon` &summarize=`7` &dateFormat=`%d.%m.%Y` &truncText=`далее...` &paginate=`1`!]
<div id="pagination"><span>Стр.:</span> [+pages+]</div>
no pages are displayed.

[Solved] When you set the "id" parameter, you should prefix the corresponding pagination placeholder with that id.
Example: [[Ditto? ... &id=`main` ...]]
[+main_pages+]

I think that I have tha same problem http://modxcms.com/forums/index.php/topic,14972.0.html
That should I do to use two ditto calls without problems?
Thanks I understood how to use it.
« Last Edit: May 20, 2007, 02:30 PM by SamZ » Logged

[MODULE] CSV IMPORT :: модуль для добавления больших каталогов, из файлов с разделителями, с сохранением древовидной структуры. russian english


[FAQ] MODX 096
(основные проблемы и способы их решения)
SamZ
Sr. Member
****
Posts: 397


всегда ищу работу :-)


WWW
« Reply #5 on: Jun 06, 2007, 11:54 PM »

Paginate does not with PHX.
I don't see pages.
Logged

[MODULE] CSV IMPORT :: модуль для добавления больших каталогов, из файлов с разделителями, с сохранением древовидной структуры. russian english


[FAQ] MODX 096
(основные проблемы и способы их решения)
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #6 on: Jun 07, 2007, 01:05 AM »

There is a known workaround for this.
Logged

SamZ
Sr. Member
****
Posts: 397


всегда ищу работу :-)


WWW
« Reply #7 on: Jun 07, 2007, 12:37 PM »

There is a known workaround for this.
Thanks
Logged

[MODULE] CSV IMPORT :: модуль для добавления больших каталогов, из файлов с разделителями, с сохранением древовидной структуры. russian english


[FAQ] MODX 096
(основные проблемы и способы их решения)
holotrope
Jr. Member
*
Posts: 7


« Reply #8 on: Jul 31, 2007, 05:31 PM »

Is there a way to use Ditto pagination on a site with Friendly URLs? I have been unable to get this to work so far.
Thanks in advance!
Tom
Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #9 on: Jul 31, 2007, 07:32 PM »

Ditto pagination should work fine with Friendly URLs out of the box. What sort of issue are you experiencing?
Logged

holotrope
Jr. Member
*
Posts: 7


« Reply #10 on: Aug 01, 2007, 11:16 AM »

Here is my Ditto call:
[!Ditto? &depth=`1` &parents=`105,106,107` &summarize=`1` &paginate=`1` &tpl=`port_page` &paginateAlwaysShowLinks=`1` &display=`1` &sortDir=`ASC` &sortby=`menuindex`!]

The return I'm getting for [+next+] and [+previous+] are something like: thisurl.html?start=1, thisurl.html?start=2, etc.

Clicking on next and previous just refreshes the current page and moves the page key to next in order. The contents aren't changing though. It's still the same page. What am I missing?
Thanks!
Tom

Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #11 on: Aug 01, 2007, 06:59 PM »

What version of Ditto, MODx, and server software (Apache / IIS, MySQL, PHP, etc.) are you running?
Logged

holotrope
Jr. Member
*
Posts: 7


« Reply #12 on: Aug 02, 2007, 09:46 AM »

Ditto 2.0.2
Modx 0.9.6
PHP 5.0.5
Linux server running Apache/1.3.37
Logged
SamZ
Sr. Member
****
Posts: 397


всегда ищу работу :-)


WWW
« Reply #13 on: Aug 02, 2007, 01:44 PM »

Do you use PHX plagin?
Logged

[MODULE] CSV IMPORT :: модуль для добавления больших каталогов, из файлов с разделителями, с сохранением древовидной структуры. russian english


[FAQ] MODX 096
(основные проблемы и способы их решения)
moebius
Jr. Member
*
Posts: 21


« Reply #14 on: Nov 27, 2007, 03:49 PM »

Hello,

I have ditto set up with pagination, and that works fine, except when there are no results I get "Page of" where my pagination links usually go. Is there any way I can get rid of these completely when I have no results?
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!