2

EE doesn't allow you to make template groups within groups.

So if you're looking to have "books/chapters/" or "book/chapters/summary" and this didn't happen coincide with channel entries, would the best bet be to use url_segments to simply control with a single template what's actually displayed?

6

Conditionals based on URL Segments is how I would handle this. For your example, I would have in my books/chapters a conditional like

{if segment_2 == "summary"}  
  {embed="embeds/summary_code"}
{/if}

I'd use an embed just to keep the template cleaner — instances where I do this do tend to be on more complex site where I like keeping things as clean as possible. It's largely optional and depends on your own coding style.

In that embed, I would then have whatever {exp:channel:entries} code (or whatnot) to output the content I need.

| improve this answer | |
  • 3
    This would be my approach as well, but I would additionally use IfElse devot-ee.com/add-ons/ifelse to reduce page load and deal with advanced conditionals. – CreateSean Nov 22 '13 at 16:01
  • @CreateSean - Thank you too I wasn't aware of that plugin looks very helpful. – jsuissa Nov 23 '13 at 20:13
  • IfElse is simply essential if you are using any advanced conditionals. When I code templates like this, I prefer to use simple conditionals and mostly use advanced ones inside the embed. – Brooks Seymore Nov 23 '13 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.