Forums / General / Offset navigator and URL
Rebecca Denham
Friday 20 March 2009 2:16:37 am
We have a large multi-lingual site developed with eZ version 401 which includes forum topics and discussions. On the forum pages we display up to 50 discussions per page and then use the standard google navigator template for viewing subsequent pages. The URLs for the subsequent pages are displayed in the standard eZ format as ".../(offset)/50".
Is it possible to modify this URL format for the subsequent pages to display just the page number instead of the user parameter name/value pair? For example, if a forum discussion includes 3 pages, the google navigator would display pages "1 2 3" with the URLs formatted as ".../(offset)/50" and ".../(offset)/100" for pages 2 and 3 respectively. I would like the URLs to be formatted as ".../2" and ".../3" for pages 2 and 3 respectively.
Thanks in advance for any suggestions.
Jean-Yves Zinsou
Friday 20 March 2009 4:08:03 am
Hi there, i don't know it this is possible in a simple way because the (offset) parameter in your url is used as view parameter in the template code to compute where to start the fetching of the nodes to list ;-(
The only way i can think of achieving this , is to make an extension with a module that takes the offset as ordered parameters ...
Is it worth it ?
Any other suggestion someone ?
Jey
Do Androids Dream of Electric Sheep? I dream of eZpubliSheep.... ------------------------------------------------------------------------ http://www.alma.fr
Benjamin Lorteau
Wednesday 01 July 2009 6:32:15 am
First of all you can change the way that offset is handled, by modifying the template to accept page numbers instead of offset number.
You would have to compute the offset passed in the fetch function, and modify navigator/google.tpl behavior to display page numbers instead of offsets in the generated links.
Then you could use Wilcards URL to transform something like
/Forum/Topic/(page)/2
into
/Forum/Topic/2
eZ Publish personal project : http://www.aeriesguard.com [fr]