1

I can't understand how to made URL structure for page For eg

http://site.com/template_group/temlate1/template2/template3

http://site.com/services/cleaning/reviews/best

In admin panel, at template group services we have 4 templates

index cleaning reviews best

Every template have url

http://site.com/services/index/

http://site.com/services/cleaning/

http://site.com/services/reviews/

http://site.com/services/best/

I need to display some templates like this

http://site.com/services/cleaning/reviews/

or

http://site.com/services/cleaning/reviews/best/

1
1

You can only nest one level of templates inside a template group. Therefore, templates generally may only extend to TWO segments into the URL. Any segments that follow (up to 7) are considered SEGMENT VARIABLES. The segment variables will be passed to the template inside the template group in the URL:

http://www.url.com/template_group/template/segment_3/segment_4/segment_5

(up to 9 segments)

You can use the segments as variables:

http://www.url.com/template_group/template/2014/04/16

In your template you can use:

{segment_3} = 2014 {segment_4} = 04 {segment_5} = 16

For more information, see: https://ellislab.com/expressionengine/user-guide/templates/globals/url_segments.html

3
  • Can u tell me example of template route for my question? Without date etc... – IMWDS Dec 10 '14 at 16:21
  • The short answer is that you cannot set up your templates the way that your example shows because it goes against the way Expression Engine works. – Victor Paredes Dec 10 '14 at 17:15
  • You cannot organize your templates more than TWO deep. It sounds like you are having trouble organizing your data? Is there a specific reason why you NEED your templates to be organized this way? – Victor Paredes Dec 10 '14 at 17:21
0

While you can not embed multiple template folders deep. You have a couple of options. In your cleaning/services template you could do something along the lines of:

{if segment_3 == "reviews"}
     {if segment_4 == ""}
        Show just this content when reviews is in segment 3 and segment 4 is empty
     {/if}
     {if segment_4 == "best"}
        This shows is segment 3 is reviews and segment 4 is best
     {/if}
     {if segment_4 == "something"}
        You can do this as many times as you need to replicate the functionality you need.
        {if segment_5 == "more"}
            You can do this upto 9 segments
        {/if} 
     {/if}
{/if}

Alternatively you could use template routes functionality if you are using newer version of EE.

In the control panel you would goto the Template Route Manager and as an example for services/reviews template you would set the route to services/cleaning/reviews/. Personally I would move the templates that you are routing into their own folder to avoid confusion down the road so it was me I would have _routes/service_reviewsbeing routed to services/cleaning/reviews/ and _routes/service_best routed to services/cleaning/reviews/best/

Your other option would be to use an add-on to manage the multiple depth functionality. This could be the built in Pages module or something like Structure. Each of these add-ons have advantages and disadvantages.

All of these options should get you the desired results one way or another.

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.