MenuManager - Custom order and pagination of the menu items
Posted: Tue Aug 19, 2008 3:11 pm
Hello,
I am building a website that is displaying some articles that represent some kind of reviews using the latest version of CMSMS. I thought that the best way to do it would be simply by using the standard core content pages since the content has pretty URLs and is easy to manage. I could use Products module or something similar but that just wouldn't be that nice and simple also I can forget about pretty urls and advanced templating... So I created a template that includes:
* {content} - for the main review
* {content block="Rating" oneline="true"} - to enter editor's rating 1-5 (only numeric)
* {content block="Duration" oneline="true"} - to enter approx. duration in minutes
Now when I build a menu of these pages using the {menu} tag I get a list of about 30 articles (more to be added soon) that are sorted by date (since new pages are added to the end of the hierarchy) or manually if I change the order of pages in administration.
Now here's what I want to do:
- give user the ability to order the pages in a menu:
* by title (that is the title of the page)
* by date of publishing
* by rating
* by duration
(and it would also be nice if I could sort these pages ascending / descending)
- now there are about 30 articles... but what when there will be more than 100 articles.. it would really be nice to make some sort of pagination for this menu - so I could somehow set offset & limit to display only 10 menu items per page and show the user next/previous buttons
Can something like this be done? I don't want to change the code of the MenuManager module since that would mean that it should never be upgraded again .. Since Smarty is very powerful I was wondering if there is a way to do it only in Smarty?
I don't mind building an array of all menu-items, sorting and then displaying them (instead of sql sort) or any other cpu intensive solution since this page will not have much traffic.
And I also don't mind if the solution would be possible using some other type of content (e.g. global content block) .. I just don't want to touch any of the main CMSMS code...
Thanx!
I am building a website that is displaying some articles that represent some kind of reviews using the latest version of CMSMS. I thought that the best way to do it would be simply by using the standard core content pages since the content has pretty URLs and is easy to manage. I could use Products module or something similar but that just wouldn't be that nice and simple also I can forget about pretty urls and advanced templating... So I created a template that includes:
* {content} - for the main review
* {content block="Rating" oneline="true"} - to enter editor's rating 1-5 (only numeric)
* {content block="Duration" oneline="true"} - to enter approx. duration in minutes
Now when I build a menu of these pages using the {menu} tag I get a list of about 30 articles (more to be added soon) that are sorted by date (since new pages are added to the end of the hierarchy) or manually if I change the order of pages in administration.
Now here's what I want to do:
- give user the ability to order the pages in a menu:
* by title (that is the title of the page)
* by date of publishing
* by rating
* by duration
(and it would also be nice if I could sort these pages ascending / descending)
- now there are about 30 articles... but what when there will be more than 100 articles.. it would really be nice to make some sort of pagination for this menu - so I could somehow set offset & limit to display only 10 menu items per page and show the user next/previous buttons
Can something like this be done? I don't want to change the code of the MenuManager module since that would mean that it should never be upgraded again .. Since Smarty is very powerful I was wondering if there is a way to do it only in Smarty?
I don't mind building an array of all menu-items, sorting and then displaying them (instead of sql sort) or any other cpu intensive solution since this page will not have much traffic.
And I also don't mind if the solution would be possible using some other type of content (e.g. global content block) .. I just don't want to touch any of the main CMSMS code...
Thanx!