Hello everyone,
In honor of the awesome new Pages feature of EE 1.6.0+ I’ve whipped up two plugins, one to create a bread crumb trail of the current page and another to create a nested menu of pages. They are both still in early development, but I’m looking for a few good chaps to check them out and report any bugs.
Thanks guys!
Download them here: http://docs.markhuot.com/ee/plugins/
Hi Mark,
This is what I have:
{exp:pages_nested_menu include_ul="no" include_root="yes" depth="5"}
<a href="http://{pnm_page_url}">{pnm_title}</a>
{/exp:pages_nested_menu}
Home gets left out. But, for my particular purpose, it’s ok that home gets left out because my site map needs home hard-coded so that I can link to some weblogs between home and the rest of the pages, all in the same list.
Sorry about that. This should be fixed now: http://docs.markhuot.com/ee/plugins/
I’m seeing some odd behavior in v1.1.8. I have the following pages defined:
/online/faq/administrative /online/faq/logistics /online/faq/earning-credit /online/faq/getting-help /online/faq/enrollment
Note that there is no page with the URL /online/faq.
I have a template named faq in the online template group, with the following code:
{exp:pages_nested_menu root="page_url" include_ul="yes" include_root="yes" depth="1"}
<a href="http://{pnm_page_url}" title="...">{pnm_title}</a>
{/exp:pages_nested_menu}
And this is the HTML that pnm is producing (tidied up a bit)
<ul>
<li><a href="http://.../online/faq/administrative/" title="...">Administrative</a>
<ul>
<li><a href="http://.../online/faq/administrative/" title="...">Administrative</a></li>
<li><a href="http://.../online/faq/logistics/" title="...">Logistics</a></li>
<li><a href="http://.../online/faq/earning-credit/" title="...">Earning Credit</a></li>
<li><a href="http://.../online/faq/getting-help/" title="...">Getting Help</a></li>
<li><a href="http://.../online/faq/enrollment/" title="...">Enrollment</a></li>
</ul>
</li>
</ul>
So it’s listing the first item twice, once as a heading, and again in its own list.
Cheers, Ben
Quick reply to my own post: if I specify a root that is a defined page, I get the expected behavior, more or less. I also have a page defined at /online/. So I tried using “/online/” as the root. Then I got:
<ul>
<li><a href="http://.../online/" title="...">Online Courses</a>
<ul>
<li><a href="http://.../online/faq/administrative/" title="...">Administrative</a>
<ul>
<li><a href="http://.../online/faq/administrative/" title="...">Administrative</a></li>
<li><a href="http://.../online/faq/logistics/" title="...">Logistics</a></li>
<li><a href="http://.../online/faq/earning-credit/" title="...">Earning Credit</a></li>
<li><a href="http://.../online/faq/getting-help/" title="...">Getting Help</a></li>
<li><a href="http://.../online/faq/enrollment/" title="...">Enrollment</a></li>
</ul>
</li>
<li><a href="http://.../online/course-login/" title="...">Course Login</a></li>
<li><a href="http://.../online/policies/" title="...">Policies</a></li>
</ul>
</li>
</ul>
So it looks to me that if pnm doesn’t find a page defined as it’s traversing down the hierarchy, it uses the next pages’ information. Or something. 😊
Ben
@Ben Kimball (UT) - This is a known ‘bug,’ although I’m not really sure how to ‘fix’ it. Assuming your tree looks like this:
online
online/faq/administrative
online/faq/logistics
online/faq/earning-credit
So, thinking in terms of semantic XHTML markup, how would that look? Something like this:
<ul>
<li>online
<ul>
<li>
<ul>
<li>administrative</li>
<li>logistics</li>
<li>earning-credit</li>
</ul>
</li>
</ul>
</li>
</ul>
So what do we do with the empty <li >? Right now we do nothing with it, and the plugin chokes up the next visible child. I’d love to hear what everyone else would expect to happen.
Let me know! thanks
Good question. In this case I fixed my issue by creating the “missing” online/faq static page. Oops, I mean Page.
However, in general it brings up the same root issue that (I expect) caused you to write the Pages module (yours, not EE’s) in the first place: URL abstraction. It seems to me that what I’m working towards is an EE system in which I can completely escape the default template group/template name URL pathing. I want my URLs to reflect a hierarchy of resources, but since I must use different templates when I want different functionality, and the templates must be stored in groups at exactly one level deep, I have to use Static Pages (the old one, now Tome) or Pages (the new one) to get the URLs I want.
So I think what I need to do is bite the bullet and assign every page on my site a Page url, so that I don’t have any “missing” intermediate pages, and then I won’t care what PNM does if it finds one. 😊 The only trouble is that I can’t assign a Page url directly to a template, only to an entry. I hadn’t made a Page for online/faq because that page doesn’t need to display any entries, just the Pages nagivation for its children. If I could have said “the Page URL online/faq should map to the template faq in the online template group” without making a weblog entry, I wouldn’t have run into this problem.
Hmm.
OK, now I’m just thinking out loud, but supposing PNM runs into an empty spot in its Pages hierarchy. Should it look at the defined templates to find out where a hit to that URL would be mapped, and somehow (getting really fuzzy now) extract information from that template? Sounds like a nightmare…
Cheers! Ben
OK, now I’m just thinking out loud, but supposing PNM runs into an empty spot in its Pages hierarchy. Should it look at the defined templates to find out where a hit to that URL would be mapped, and somehow (getting really fuzzy now) extract information from that template? Sounds like a nightmare…
That’s actually a planned feature. Including the ability to map ‘dynamic’ entries to the menu through the URL defined in a weblog’s preferences.
So I think what I need to do is bite the bullet and assign every page on my site a Page url, so that I don’t have any “missing”
It’d be great though if you could have some ‘missing’ pages, I’m just not sure what should display? Any suggestions for pages that are not in a page url, not in a template, and not in an entry?
It’d be great though if you could have some ‘missing’ pages, I’m just not sure what should display? Any suggestions for pages that are not in a page url, not in a template, and not in an entry?
I admit I haven’t fully thought this out, but here’s a radical idea: what if you just “promoted” the innards up one level? I realized that if you’d done that, I never would have been the wiser. So:
/online
/online/faq/one
/online/faq/two
/classroom
becomes (from the root, /)
<ul>
<li>[Online](/online)
<ul>
<li>[One](/online/faq/one)</li>
<li>[Two](/online/faq/two)</li>
</ul>
</li>
<li>[Classroom](/classroom)</li>
</ul>
Note that in the above example, all four links were “promoted”. Since there was no Page defined with the root URL /, all of its “innards” (online and classroom) were promoted to be root URLs. Then I go into /online, and see that there’s another missing level, so I “promote” One and Two.
Cheers! Ben
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.