Purchase a license: $65

Full refunds available within 30 days.

EE2 + compatible

Questions + support for purchased licenses: support@buildwithstructure.com


Categories: Sorting and Displaying

Category: Displaying Content

  1. Download and install Freebie: http://devot-ee.com/add-ons/freebie
  2. Read the Freebie docs for an understanding of its tags: https://github.com/averyvery/Freebie#readme
  3. Enable the Freebie extension under Add-Ons » Extensions
  4. Configure Freebie under Add-Ons » Extensions » Freebie » Settings
    • Freebie segments: add your category trigger (this can be anything and does not need to match your EE category trigger setting, you'll set it below in the template code)
    • Breaking segments: add the same word as the above setting
    • Break on category URL indicator: this setting does not matter because we're not using normal category URLs
  5. Create a new template for your new page and listing. We'll use segment conditionals to determine if it's a full listing, category listing or detail page.
  6. Optionally, you can use a different template for detail pages if desired by using the setting under Structure » Channel Settings for your listing. This example uses the same template for both the main page holding the listing and the listing detail entry.

    Linking To Your Categories

    This example shows a category listing 2 levels deep within a hierarchy, so the segments and links need to be adjusted to fit where your listing lives. The example listing lives at the second segment for example purposes.

    	<li><a href="/index.php/{segment_1}/{segment_2}/category/category-name-1">Category 1</a></li>
    	<li><a href="/index.php/{segment_1}/{segment_2}/category/category-name-2">Category 2</a></li>

    Calling Entries In Your Templates

    We'll use segment conditionals to see if Freebie segments exist, which our extension settings are telling EE to ignore:

    {!--- /////////////////////// FULL LISTING (ALL ENTRIES) /////////////////////// --}
    {if "{freebie_3}" == ""}
    <h3>Page Name</h3>
    	{exp:channel:entries channel="listing-channel-name" dynamic="no"}
    	<li><a href="{page_url}">{title}</a></li>
    {!--- /////////////////////// CATEGORY ENTRIES /////////////////////// --}
    {if:elseif "{freebie_3}" == "category"}
    <h3>Category: {freebie_4}</h3>
    	{exp:channel:entries channel="listing-channel-name" category="{exp:freebie:category_id segment='4'}" dynamic="no" parse="inward"}
    	<li><a href="{page_url}">{title}</a></li>
    {!--- /////////////////////// DETAIL PAGE /////////////////////// --}

« All Documentation