Skip to main content

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}

{category_name}

{/if} {/exp:channel:categories} {/if}

                {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">
     {exp:channel:entries channel="{freebie_1}" category="{last_segment_category_id}" paginate="bottom" limit="20" dynamic="no"} 
      <a href="{category_url_title}"><h2>{category_name}</h2>
                  <div class="Product1">
 <img src="{category_image}" alt="{category_name}" title="{category_name}" /></a>
            </div>
        {/if}

   <a href="/{freebie_1}{freebie_2}/{page_uriexp:channel:categories}"><h2> 

{title}</h2>if}
  
{if freebie_2 != "" && freebie_3 != ""}

    {exp:channel:entries  
        channel="{freebie_1}"  
     <img src="{baler_images}" alt="{title}" title="category="{titlelast_segment_category_id}" /></a>
             paginate="bottom" limit="20" dynamic="no"}

        <div </div>class="Product1">
                   <a href="/{freebie_1}{freebie_2}/exp:channel:entries{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.

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}

{category_name}

{/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.

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.

Source Link

Channel Entries - Structure / Categories / URLs

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}

{category_name}

{/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.