You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by Thomas Aylott - subtleGradient <te...@subtleGradient.com> on 2008/05/02 22:56:10 UTC

Pager, Entries vs Sets : SDN Channel

Howdy.
I'm doing the new SDNChannel blog and we have an unusual structure.
http://blogs.sun.com/SDNChannel
http://blogs.sun.com/subtlegradientsdn

We have an entry shown in details, and then the summaries of all the  
rest of the entries in the same category should be paged on the bottom.

But the pager seems to only default to paging between individual  
entries.
How do I get it to page by sets of entries instead of individual  
entries?

Thanks!

http://projects.subtlegradient.com/sdn/Build/sdn_theme/Weblog.vm


Re: Pager, Entries vs Sets : SDN Channel

Posted by Allen Gilliland <Al...@Sun.COM>.
In Roller the length of all pagers are defined by a weblog setting for 
"number of entries to display on weblog".  It looks like you are trying 
to setup the blog so that it only shows 1 entry at a time, so I'm 
guessing that you have that value set to 1, which means that when you 
get access to a pager it will page through the collection 1 entry at a time.

Since it looks like your general approach is to only ever display 1 
entry at a time, you may be better served trying to get users to the 
permalink urls.  You could do this by setting up the primary blog index 
pages to use simple html redirects.  Here's something to try ...

1. Make sure you have a custom permalink template.  If not, add one by 
going to the "Templates" page and on the right side create a template 
called "permalink" and choose the action "permalink".  Then copy your 
existing Weblog template into that one.  From this point on, when 
someone accesses a specific entry it'll be rendered from the permalink 
template.

2. Set your "number of entries to display on weblog" property to what 
you want your pager length to be, like 5 or 10.

3. In your Weblog template use a little logic which uses an html 
redirect to send the client to the appropriate entry.  Put this in the 
<head> section of an empty html document ...

#set($map = $model.weblogEntriesPager.entries)
#foreach($day in $map.keySet())
     #if($velocityCount == 1)
         #set($firstEntry = $map.get($day).get(0))
     #end
#end
<meta http-equiv="REFRESH" content="0;url=$url.entry($firstEntry.anchor)">

4. Now in your permalink template you should be able to access a pager 
which provides 5 or 10 entries per view.  If you want the entries from 
the same category as the current entry being viewed then this would be 
what you want ...

#set($categoryPager = $model.getWeblogEntriesPager($weblogCategory.path))

HTH,

-- Allen


Thomas Aylott - subtleGradient wrote:
> Howdy.
> I'm doing the new SDNChannel blog and we have an unusual structure.
> http://blogs.sun.com/SDNChannel
> http://blogs.sun.com/subtlegradientsdn
> 
> We have an entry shown in details, and then the summaries of all the 
> rest of the entries in the same category should be paged on the bottom.
> 
> But the pager seems to only default to paging between individual entries.
> How do I get it to page by sets of entries instead of individual entries?
> 
> Thanks!
> 
> http://projects.subtlegradient.com/sdn/Build/sdn_theme/Weblog.vm
>