ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Navigation and URL structure beyond two deep

August 13, 2008 2:02am

Subscribe [4]
  • #1 / Aug 13, 2008 2:02am

    scottmoa

    19 posts

    I must admit that my brain is a little sore right now. I can do some decent, if not cludgy, pile of conditionals to construct a site but I think I must be missing something obvious. I’ve moved content over, played with all kinds of photo management tools and gotten damn near everything else lined up. But I’m missing something that MUST be easy and obvious.

    A simplified slice of the site architecture for our organization:

    The Club
    —-About Us
    ———Mission Statement
    ———Staff
    ———Officers
    —-Membership
    —-Benefits
    —-Join
    Flea Market
    Forum


    A user chooses The Club and ends up at a splash page and the subnavigation is open. They then click on “About Us” taking them to:
    http://www.sitename.com/club/about_us

    If they go a bit deeper to “Officers”, I’d like them to be at:
    http://www.sitename.com/club/about_us/officers/

    Easy, right?
    This is basic friendly URL structure that makes constructing things like breadcrumbs and formatting navigation extremely easy. Further, whatever tier you’re at in the URL should be a page and even a page as deep as /club/about_us/officers needs to be not necessarily be a single entry page. In the case of “officers” it would be a list of individual entries for the different officers.
    Easy, right?

    At this point, I’ve got a weblog for each section of the site and tied to that weblog a collection of categories and subcategories relating to these different pages, and I’ve synched the template, category, and weblog names to make it all somewhat interchangeable. It would *seem* like the URL should be parsed by:
    http://www.sitename.com/weblog/category/subcategory/.../../entry

    But, obviously, it’s:
    http://www.sitename.com/template_group/template/entry

    So how do I make this model work for me? If you’re at the “template” level, how do I show one kind of page and then use a different template for what is usually the “entry” level?

    So what’s the *best* way to do this? I know there are a bunch of different ways but how would YOU do it?

    Thank you in advance. I have read and read and read some more. I’m obviously missing something because this seems like such an obvious need.

  • #2 / Aug 13, 2008 3:10am

    PXLated

    1800 posts

    Remembering that weblogs are content and templates are display/presentation and URLs…

    Just taking one section…

    Content (Weblogs) - I would have several weblogs each with their own custom fields to accomodate the various types of content. The Mission statement is probably a title and body and be one entry in the weblog whereas the Staff would be Name, Title, Description, Etc. and there would be a separate entry in the weblog for each person.

    Templates - I’d have a templateGroup named “club” and a template within called “about-us. I would use conditionals based upon the next URL segment (staff, etc) to display the proper content within the “about_us” template.

    Does that help point in the right direction?

  • #3 / Aug 13, 2008 5:05pm

    scottmoa

    19 posts

    Thanks for the reply!

    I guess that’s what I was trying to avoid, having to set up a whole bunch of different templates and conditionals to parse out the page content. It seems like it’ll either be cludgy or a bitch to update if the site structure changes.

    Thinking…
    It would seem like the best way to handle it might be some kind of master parsing script that gets included in the different pages that also handles navigation set up. It’s a little extra load everywhere but might stream line future changes and might make it possible for the end users to make some updates without needing my assistance.

    I’d probably use nested categories… and…

  • #4 / Aug 13, 2008 5:29pm

    ImpGabe

    171 posts

    If you do use the conditionals method, stick to simple conditionals. The if:elseif stuff apparently lags down sites. Also, comment, comment, comment!

  • #5 / Aug 13, 2008 5:54pm

    scottmoa

    19 posts

    What do you mean by “simple conditionals”?
    This is faster:

    {If x=b } do this {/if}
    {if x=c} do this {/if}

    than this?

    {if x=b}do this
    {if:else x=c}do this{/if

    That seems very odd.

    Does ‘plain’, even embedded, PHP run faster than the EE code?

    Again, thank you for the assistance. I feel like I’ve got my head pretty well around EE but I’m trying to find the most efficient ways to handle things. I’ve developed techniques over years of working with PHP that don’t necessarily apply.

  • #6 / Aug 13, 2008 5:58pm

    Ingmar

    29245 posts

    First of all, you must use a double equation sign, like so:

    {if x=="b"} do this {/if}

    That said, using if:else does not necessarily slow things down, but so-called “advanced” conditionals are parsed at a different stage than “simple” conditionals. Depending on your template, this can have an impact on performance.

  • #7 / Aug 13, 2008 5:58pm

    ImpGabe

    171 posts

    Yeah, that’s what I mean. I think the if:else statements are ok. But when you use if:elseif EE runs queries for all the conditionals. If you use straight if statements, then it only runs queries for the conditions that get met.

    This thread talks about it.

  • #8 / Aug 13, 2008 6:08pm

    scottmoa

    19 posts

    First of all, you must use a double equation sign, like so:

    {if x=="b"} do this {/if}

    That said, using if:else does not necessarily slow things down, but so-called “advanced” conditionals are parsed at a different stage than “simple” conditionals. Depending on your template, this can have an impact on performance.

    I prefer to pepper a few sloppy single equal signs in to my code. It keeps me on my feet.  😉

    Thanks for the tips guys. I see a possible module or extension in my future.

  • #9 / Aug 13, 2008 8:51pm

    PXLated

    1800 posts

    Thanks for the tips guys. I see a possible module or extension in my future.

    Really! You mentioned cludgy, that’s cludgy.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases