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.

template and channel structure without using Pages

January 30, 2012 6:59pm

Subscribe [2]
  • #1 / Jan 30, 2012 6:59pm

    thoms005

    39 posts

    In the past I have used Pages to map my url structure to my content. I don’t think that is the best way to do it (the Pages uri and url are confusing for end users) so I want to figure out how to not use Pages. I have these urls:

    mydomain/cats/page1
    mydomain/cats/page2
    mydomain/dogs/page1
    mydomain/dogs/page2

    I want cats to be a channel and dogs to be a different channel. Basically, I will have a channel for each main nav area. Tell me if that is a silly way to organize my content. It makes sense to me and end users.

    All the pages for cats, dogs, fish, etc have the same layout. So I want them to use the same template group (and it is not the same as the home page, home has its own template).

    Since urls are by definition mydomain/template_group/template, I’m stumped how to get cats and dogs to both use the same template.

    Thanks.

  • #2 / Jan 30, 2012 11:26pm

    Boyink!

    5011 posts

    A few thoughts:

    Content organization can (and should, I think) be looked at distinctly from template organization.  Content should be “normalized” like a database would, would distinct channels for distinct content types (and better if you can define them past a page).  Mapping content out to templates is the next step in the planning process.

    A few ideas to get your desired URLs:

    1 -  Create separate template groups and duplicate the markup.  Yes, I know, it’s not totally DRY but it’s still a reasonable solution, especially if there are just a handful of templates.

    2 - Create separate template groups but embed a shared template, passing it embed variables to dictate which channels get used, etc.  This is more DRY, but comes at a cost of extra memory use and template processing time.

    3. Create separate template groups and templates with generous use of snippets for repeated code.  DRY-ish, but with better performance than #2 (in general anyway).

  • #3 / Jan 31, 2012 10:18am

    thoms005

    39 posts

    Thanks for the reply. I’m looking for a 100% DRY solution.

    I agree that normalizing content is important. In my made up example cats, dogs and fish are all the same kind of content except they need to be in groups so the nav structure can be built. Is there is a better way to group them than separate channels? Maybe all in one channel with categories?

    If anyone has any other thoughts I am very interested.

  • #4 / Jan 31, 2012 10:32am

    Boyink!

    5011 posts

    IMHO DRY is a great goal, but sometimes you have to look at different aspects of performance:

    - System performance. 
    - Developer performance.
    - Client performance.

    Yes, 100% DRY is a great goal for developer performance, but can come at a cost of system performance and/or client performance. 

    For example, since those content types are all the same the database/content normalization person would want them all in one channel (table).  But from a client perspective having Publish/Edit menus that more closely reflect the site nav structure is often more intuitive, so breaking them out into separate channels makes more sense (especially when they can share field groups and you can pipe in multiple channels in one channel entries tag etc).

    Keep in mind from a channel perspective adding a channel != adding a database table.  Additional channels just extend existing tables.

    Were it me I’d:

    - Create a shared field group for the similar content.
    - Create one channel per main nav item
    - Create template groups & templates per main nav sections
    - Use a combination of snippets & embedded templates to be reasonably DRY with site elements that are most likely to change.
    - Live with a bit of repeated markup / skeleton of HTML structure in templates as that rarely changes incrementally (more likely is a complete re-do) and if it does change incrementally making changes in even a small number of templates doesn’t take that long.

  • #5 / Jan 31, 2012 11:10am

    thoms005

    39 posts

    Thank you again. At least I know now I am not missing something conceptual about EE around this. I appreciate your advice.

  • #6 / Jan 31, 2012 5:04pm

    Sean C. Smith

    3818 posts

    Thoms005,

    Looks to me like Mike was able to give you some super answers. Is there anything else I can do to help?

    Sean

  • #7 / Jan 31, 2012 5:54pm

    thoms005

    39 posts

    I’m good, thanks.

  • #8 / Feb 03, 2012 8:38pm

    Sean C. Smith

    3818 posts

    Excellent. I’m going to close out this thread, but feel free to post again when you have more questions.

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

ExpressionEngine News!

#eecms, #events, #releases