We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pages Crumbs and Pages Nested Menu

Development and Programming

Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

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/

       
Eric Barstad's avatar
Eric Barstad
198 posts
17 years ago
Eric Barstad's avatar Eric Barstad

Awesome, Mark!

I just tried the nested menu and it works great. I’m using it for a site map. One thing I noticed is that it ignores my home page, which is set up as a static page using “/” as the URI.

Thanks for sharing.

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

Try setting “include_root” to “yes”

       
Eric Barstad's avatar
Eric Barstad
198 posts
17 years ago
Eric Barstad's avatar Eric Barstad

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.

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

Sorry about that. This should be fixed now: http://docs.markhuot.com/ee/plugins/

       
Sam C's avatar
Sam C
16 posts
17 years ago
Sam C's avatar Sam C

Nice work, I’ll see if I can find time to test it out. In what order does it list child pages, alphabetical?

Also, does anyone have any plans to do a control panel module mimic’ing the Tome hierarchal interface for adding and editing pages, for the EE pages module?

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

Sam123 - By default it lists pages alphabetically. However if you set up a sort field within EE you can make a custom sort (similar to the Reeorder plugin). You can find the exact syntax on my Docs page.

       
WilsonLearningWorldwide's avatar
WilsonLearningWorldwide
2 posts
17 years ago
WilsonLearningWorldwide's avatar WilsonLearningWorldwide

Hey I tried out the crumbs and they look great!

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

@WilsonLearningWorldwide - Woo Hoo! Maybe it isn’t as beta as I thought 😉

       
Ben Kimball (UT)'s avatar
Ben Kimball (UT)
33 posts
17 years ago
Ben Kimball (UT)'s avatar Ben Kimball (UT)

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

       
Ben Kimball (UT)'s avatar
Ben Kimball (UT)
33 posts
17 years ago
Ben Kimball (UT)'s avatar Ben Kimball (UT)

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

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

@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.

  • Should it leave it blank?
  • Should it ignore that <li > all together?
  • Should it error out and display nothing at all?

Let me know! thanks

       
Ben Kimball (UT)'s avatar
Ben Kimball (UT)
33 posts
17 years ago
Ben Kimball (UT)'s avatar Ben Kimball (UT)

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

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot
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?

       
Ben Kimball (UT)'s avatar
Ben Kimball (UT)
33 posts
17 years ago
Ben Kimball (UT)'s avatar Ben Kimball (UT)
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

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.