ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Show entries associated to Category on detail page

October 01, 2009 8:00pm

Subscribe [2]
  • #1 / Oct 01, 2009 8:00pm

    cuebit

    28 posts

    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?

  • #2 / Oct 01, 2009 8:04pm

    Mark Bowen

    12637 posts

    Sorry didn’t read the whole of all the code you have above but I think perhaps the related_categories_mode=”“ may well help out on this one.

    Sorry for not reading the whole post thoroughly but it’s been a very very long day and it’s getting late here this side of the pond 😉

    Hope that helps a bit though.

    Best wishes,

    Mark

  • #3 / Oct 02, 2009 4:38am

    cuebit

    28 posts

    Hi Mark,

    thanks for the suggestion, and sorry for keeping you up!

    I should have said that I had tried this.

    I think the problem is the missing Categories segment from the URL. Without this on the detail page EE is lost.

    And so am I!

    A

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases