Aim
To display entries associated with a category on an entry detail page.
The set up
I am using Categories to group my Projects featured on the website. So, Categories and Projects look like this:
Housing Projects (Category)
– Project title 1 (Entry title)
– Project title 2 (Entry title)
– Project title 3 (Entry title)
Retail Projects (Category)
– Project title 1 (Entry title)
– Project title 1 (Entry title)
– Project title 1 (Entry title)
And so on.
I have set up three different page templates, following Michael Boyink’s walk through.
The index page
http://www.mywebsite/index.php/projects/
This shows a list of all of the Categories, and links to the Category List page.
{exp:weblog:categories weblog="projects" style="linear" show_empty="no"}
<li><a href="http://{path=projects/list}"><span class="selected">{category_name}</span></a></li>
{/exp:weblog:categories}
The Category List page
http://www.mywebsite/projects/list/category/housing/
This now displays the Category list, plus the Entries associated with the selected Category.
{exp:weblog:category_heading weblog="projects" }
<li>{category_name}</li>
{/exp:weblog:category_heading}
{exp:weblog:entries weblog="projects" sort="asc" orderby="title"}
<li><a href="http://{url_title_path=projects/detail/}">{title}</li>_{/exp:weblog:entries}__The Category Entry Detail page_[url=http://www.mywebsite/projects/detail/project_1]http://www.mywebsite/projects/detail/project_1
This page is now basically showing the details from the associated Entry, but the list of associated Entries only displays the title of the entry on the page.
{exp:weblog:entries weblog="projects" sort="asc" orderby="title"}
<li><a href="{url_title_path=projects/detail}">{title}[/url]</li>
{/exp:weblog:entries}I know the problem is down to the fact that I have lost the magic category/category name from the url, and on the detail page EE cannot figure our what Category is being displayed.
How can I get around this?