I've spent so many hours trying to work this issue out. Aggravating. I have a channel "Baler", this channel has various categories and these categories have sub categories. eg:
Balers - Parent Category - Sub Category - Sub Category
I would like to display the content for each page based on the last segment of the url. In order to do this do I need to create a structure page for each category(even though when I create a category it is assigned a URL)
Right now my code looks like this:
{if freebie_2 != "" && freebie_3 == ""}
{exp:channel:categories
channel="{freebie_1}"
style="linear"
category="{last_segment_category_id}"}
{if {parent_id} != 0}
<div class="Product1">
<a href="{category_url_title}"><h2>{category_name}</h2>
<img src="{category_image}" alt="{category_name}" title="{category_name}" /></a>
</div>
{/if}
{/exp:channel:categories}
{/if}
{if freebie_2 != "" && freebie_3 != ""}
{exp:channel:entries
channel="{freebie_1}"
category="{last_segment_category_id}"
paginate="bottom" limit="20" dynamic="no"}
<div class="Product1">
<a href="/{freebie_1}{freebie_2}/{page_uri}"><h2>{title}</h2>
<img src="{baler_images}" alt="{title}" title="{title}" /></a>
</div>
{/exp:channel:entries}
{/if}
The main issue is, that if I have to add in 500 categories and sub categories, do I need to create all of these as structure pages also? Any help or guidance would be really appreciated.