2

I'd like to use some templates to display content at segment 4 of the URL.

http://example.com/news/world/australia/melbourne

News and World have their own templates and Australia is channel entry that uses the same template as World. I'd like to extend the Australia channel entry to Melbourne and use a new template but not sure how?

  • Would Melbourne be its own channel entry as well? – Romans-8---31-39 Feb 18 '14 at 14:23
1

There are probably other ways to do it, but you could…

Turn off dynamic processing of url's since segment_3 will not be an article title. Then use {if} statements. For example, something like:

{if segment_3 =="australia" AND segment_4 ==""}
   <p>return this</p>
{if:else segment_3 =="australia" AND segment_4 =="melbourne"}
    {embed="australia/cities"}
{/if}

Your template to process city information, would then be displayed on the country template. It's like setting up a single page site processor, within a template group. Basically, you are controlling the url with various {if} statements.

My only concern here would be about the potential number of cities you'd like to display. Manual specification of the cities pretty much means manual modification of template every time a new city is added. You might want something more flexible to add cities on the fly.

| improve this answer | |
  • Thanks for the response @nonprofit_tech Segment 3 is also an article title. The number of entries will already have for the cities segment is over 200 which makes manual insertion of {if} statements cumbersome. But it as an option. – Bryan Hickey Feb 19 '14 at 22:29
  • Yes, its not the most practical method for handling large amounts of similar data. You could possibly get rid of the /world/ template and make the process more automatic if you do /news/australia/city where world is still an area, but only to select an area. – nonprofit_tech Feb 25 '14 at 16:17

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.