Hi all,
The Pages Menu Plugin returns a menu of pages created with the Pages module.
SIMPLE EXAMPLE:
{exp:pages_menu}
<a href="http://{url}">{title}</a>
{/exp:pages_menu}
OTHER EXAMPLE: (lists some of the available parameters and variables)
PARAMETERS: site_id (limit entries to one site) weblog_id (limit entries to one weblog) author_id (limit entries to one author) status (limit entries by status) default is ‘open’ order_by (any available field in exp_weblog_titles) default is entry_date sort (asc, desc) default is DESC limit (number of entries you want to show)
VARIABLES: {title} {url} {entry_id} {site_id} {weblog_id} {author_id} {url_title} {entry_id} {status} {count} {switch} {item_total}
NOTE:
It is possible to create a menu like this using the exp:weblog tag ( I discovered this myself after creating this plugin :lol: ) but the plugin is about 10 times faster! but the plugin might be a bit faster. ( happy Mr. Jones? 😉 )
WEBLOG TAG EXAMPLE:
Chris, you might place a feature request for the {page_…} variables to be made available to the Category Archive tag, as that is the typical output.
Incidentally, in my tests, this plugin was about 2-5 (not 10) times faster than the weblog entries tags, but the speed difference isn’t perceivable. You likely wouldn’t even know unless you were looking at the template parsing log and got your calculator out. 3-6 hundredths of a second or thereabouts is what I experienced. And of course, the Weblog entries tag has more robust implementation options, so the tradeoff is often entirely warranted. It’s also worth mentioning that if you use tag caching, the small speed difference is entirely nullified.
I’m not wanting to discourage people from working on or using Pages plugins, for the record, but I also don’t want users to get confused and think that a plugin is required for this rather basic functionality.
Edit: After a brief conversation with Cocoaholic, I see the difference in multiplier is staring and stopping our calculations at different points in the template parsing, but the measurement of actual time added to template rendering was the same.
Cocoaholic this is a great plugin!
Thanks for your work on this and for sharing it!
I’ll second the use of categories. Either way (parameters or results) I’m guessing I could then utilize this plugin to power a dynamically driven navigation with a drop down menu!
So when someone adds a static page to a particular category it automatically adds a navigation link in my drop down menu or it automatically adds to my side bar of other “relevant pages”.
Thanks again
Thanks zitro62,
Since the same functionality can be achieved using EE tags I probably won’t develop this plugin any further. There is a feature request for adding the {page_…} variables to the Category Archive tag, I hope we’ll see that soon.
I have however updated the plugin to version 1.1
Changes: - the plugin now only shows current entries (not expired or in the fututre) - optimized the code (thanks for your suggestions Derek!)
Cheers!
I’d like to organize the results by category, as in:
I made this somewhat deprecated plugin to create an expanding menu based on categories.
It was actually easy to transform it into a plugin that creates the same type of menu for pages created with the Pages Module. With the added benefit that it uses the pages-URIs instead of the category links. Once I have an 1.6 online to demonstrate it you may check it out.
Sorry peeps, I can’t help it…
version 1.2 adds a {current_page} variable. It can be used in 2 ways, as a variable that returns “current” or conditional.
example:
<li {if url == current_page}class="current"{/if}><a href="http://{url}">{title}</a></li>
or just:
<li class="{current_page}"><a href="http://{url}">{title}</a></li>
which will output:
<li class="current"><a href="http://{url}">{title}</a></li>
Looks like it’s flat…
Which is too bad. My PHP is too weak to even know how this would be done, but it would be great if the URIs could be parsed to determine nesting. For example, if you created the following page URIs:
/about/ /about/the_players/
the plugin could see that the second URI is the child of the first and output the nav accordingly.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.