Aug 08, 2008, 01:36 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:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1] 2   Go Down
  Print  
Author Topic: Pagination - how to limit # of visible links?  (Read 9894 times)
0 Members and 1 Guest are viewing this topic.
Errant
Jr. Member
*
Posts: 18


« on: Apr 15, 2007, 11:12 AM »

Hi all. Straight to the question - can such kind of pagination be made with Ditto:

[1][2][3][4][5] ... [34][35][36]

?

I mean, links in between are hidden and shown only then your're on pages near to them. By default, all pages are shown. Solutions like limiting # of pages (&total) or creating an archive not good for me.
Logged

"Sorry for my english"
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #1 on: Apr 15, 2007, 03:08 PM »

Yes, with a snippet like this
« Last Edit: May 06, 2007, 07:00 PM by Mark » Logged

Errant
Jr. Member
*
Posts: 18


« Reply #2 on: Apr 16, 2007, 10:15 AM »

This snippet outputs links even better than I wanted to =) Thank you Mark!

There was a little trouble with making snippet work - links wasn't splitted with such call:

[[Ditto? &summarize=`3` &total=`77` &parents=`61,64,66,67,47` &depth=`5` &hideFolders=`1` &tpl=`np` &tplAlt=`npalt` &tplFirst=`npfirst` &paginateAlwaysShowLinks=`1` &extenders=`summary` &truncLen=`500` &truncOffset=`100` &truncText=`Читать далее...` &paginate=`1` &dateFormat=`%B %d %Y, %H:%M` &tplTrunc=`ditto_readmore` &hiddenFields=`news_source`]]

[[splitPagination]]

Cached and uncached, different settings for total and summarize were used. So I've change [+pages+] to [[splitPagination]] in my template, and modify last snippet string: "if ($return) return $ph;" to just "return $ph;".

Maybe it's not a correct way and i'm missing smth, but it working and me is happy :]
Logged

"Sorry for my english"
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #3 on: Apr 16, 2007, 10:21 AM »

The snippet above sets [+splitPages+] for you to use instead of [+pages+]. If you call it with &return=`1` it will return the value back to you instead of placing the output in a placeholder. Remember, never call pagination calls cached unless the page is uncached.
Logged

Errant
Jr. Member
*
Posts: 18


« Reply #4 on: Apr 16, 2007, 02:17 PM »

Thanks for clearing things. I think this snippet could be listed in repository or embedded in ditto.
Logged

"Sorry for my english"
gcruz
Member
**
Posts: 98


« Reply #5 on: Apr 16, 2007, 03:43 PM »

So will it read the splitter marker and make pages?
Can I show section names instead of pages?

Thanks,

Gary

[Edit] Removed quote for readability
« Last Edit: Apr 16, 2007, 07:33 PM by Mark » Logged
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #6 on: Apr 16, 2007, 07:37 PM »

This snippet is just a different version of [+pages+]. What do you mean by show section names?
Logged

gcruz
Member
**
Posts: 98


« Reply #7 on: Apr 18, 2007, 01:05 AM »

This snippet is just a different version of [+pages+]. What do you mean by show section names?

Typically, I would have multiple documents in a folder, and use wayfinder or ditto to generate pages.
Section name would be the title of the page.

But let's say there is one document that I want to split up.

Each page would be called by the section where I would put the split.
In this case, it would have to be the h3 or whatever header I put.

Hope that made sense.
Logged
gl330k
Member
**
Posts: 68


« Reply #8 on: Jul 20, 2007, 01:42 PM »

Ok. I'm not understanding the execution of this snippet. Can someone help me. I have the following in a document

[!Ditto? &parents=`46` &summarize=`10` &total=`20` &commentsChunk=`blog_CommentsBlog` &tpl=`blog_BlogTemplate` &dateSource=`pub_date` &dateFormat=`%m-%d-%Y` &sortBy=`pub_date` &paginate=`1` &paginateAlwaysShowLinks=`1` !]

[!splitPagination!]

I'm expecting a 2 page notification at the end of a list of 10 entries but it's doing nothing. What am I doing wrong?

Thanks,
gl330k

Logged
yentsun
MODx Russia
Moderators
*
Posts: 514



WWW
« Reply #9 on: Feb 01, 2008, 04:42 AM »

I have about 4000 docs to output with Ditto, so this snippet is the only way I can do pagination with (the usual [+pages+] simply won't fit into screen). But splitPagination behave somewhat strange... it adds an extra page at start ([1][1][2][3]...) and the active page won't turn into <span>, so we do not see the active page actually. Here is the page with my case: http://s31183.gridserver.com/news

Please help me with that... its kind of crucial for me Smiley
Thanks in advance.
« Last Edit: Feb 01, 2008, 05:19 AM by yentsun » Logged

http://modx.ru - российская поддержка MODx
http://modxnotes.blogspot.com/ - личный блог по MODx
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #10 on: Feb 01, 2008, 07:56 PM »

Could you provide the Ditto and splitPagination calls you are using?
Logged

yentsun
MODx Russia
Moderators
*
Posts: 514



WWW
« Reply #11 on: Feb 13, 2008, 03:14 AM »

I'm so sorry Mark! Forgot to provide the call... here it is
Code:
[[Ditto? &tpl=`news_item_ext` &summarize=`22` &paginate=`1` &extenders=`request,dateFilter,cal_dateFilter` &dateSource=`createdon` &depth=`2` &hideFolders=`1` &tagData=`tags` &tagSort=`0` &tagDelimiter=`, ` &tagDisplayDelimiter=` ` &seeThruUnpub=`0` &filter=`isnews,1,2`]]
<div class="pages">
[[splitPagination? &return=`1`]]
</div>

The page is uncached ofcourse.
Logged

http://modx.ru - российская поддержка MODx
http://modxnotes.blogspot.com/ - личный блог по MODx
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #12 on: Feb 13, 2008, 06:18 PM »

I would try setting the same Ditto ID on both the Ditto call itself and the splitPagination snippet.
Logged

yentsun
MODx Russia
Moderators
*
Posts: 514



WWW
« Reply #13 on: Feb 15, 2008, 02:52 AM »

Mark, I've added ids to both Ditto and splitPagination calls like this:
Code:
[[Ditto? &tpl=`news_item_ext` &summarize=`22` &paginate=`1` &extenders=`request,dateFilter,cal_dateFilter` &dateSource=`createdon` &depth=`2` &hideFolders=`1` &tagData=`tags` &tagSort=`0` &tagDelimiter=`, ` &tagDisplayDelimiter=` ` &seeThruUnpub=`0` &filter=`isnews,1,2` &id=`main`]]
<div class="pages">
[[splitPagination? &return=`1` &id=`main`]]
</div>

And it didn't help Sad
Logged

http://modx.ru - российская поддержка MODx
http://modxnotes.blogspot.com/ - личный блог по MODx
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #14 on: Feb 16, 2008, 11:30 PM »

Try setting both calls to uncached, even if it is on an uncached page. Also, try removing all the Ditto parameters and if it works, add them back in one at a time until it breaks.
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!