I'm struggling to understand what is the "proper" way to build URLs in EE. I think I want my URLs to be built in such a way that it can take advantage of EE's dyanamic="yes"
, etc. Right now, I can build URLs and use certain segments to display the content I want, but I'm not sure if I am doing it correctly.
Say I am building a simple forum. I have a Channel forum_topics
which has Categories. I want to do the following:
- Display a page with a list of categories. Each category will link to a list of Channel entries with that category. Also, ideally, I'd like to list the last 10 entries for each category on this page. Is this possible?
- Display a list of Channel entries for a given category. Each channel entry will link to that entry's single entry page.
- Display the single entry page.
I can do it, but I'm just not sure if I am doing it the "EE way." Here are the snippets of how I'm doing it:
1. FIRST template: loop through categories, create list of links to SECOND template
{exp:channel:categories
category_group="1"
status="open"
style="linear"
}
<a href="/forums/{category_id}/">{category_name}</a>
{/exp:channel:categories}
2. SECOND template: use segment_2 in {exp:channel:entries}, set {entry_id} as 3rd segment
{exp:channel:entries
category="{segment_2}"
channel="forum_topics"
}
<a href="{url_title_path='/forums/topics/{entry_id}/'}">{title}</a>
{/exp:channel:entries}
3. THIRD template: use segment_3
{exp:channel:entries
channel="forum_topics"
entry_id="{segment_3}"
}
<h1>{title}</h1>
{/exp:channel:entries}
Any suggestions?