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.

Combining a category group across numerous channels

July 30, 2012 9:27am

Subscribe [2]
  • #1 / Jul 30, 2012 9:27am

    TwelveHorses

    5 posts

    I had a question regarding combining a category group across numerous channels and use the category selected to determine the content displayed.

    I have created a category that lists the services the client specialises in.

    We have three channels that use this category group
    1. Staff channel – We use the category group to determine the services the staff member specialises in
    2. Services channel – We use the category group to determine what area of the business the service described applies to
    3. Articles channel – Their marketing team publish articles related to services they provide

    So for example, one service they provide is “funds” advice so we want to create a “fund” home page that pulls in content from the channels listed above. All of the staff members, services entry and articles that relate to “funds” have that box checked in the category tab of their entry. They all share the same category selection.

    We have created the page and it is pulling in the correct services info and the staff members related to funds but we can’t get the articles to appear 100% correct.

    We want to pull in the latest 5 articles that relate to “funds” but at the moment all we can do is pull the latest 5 regardless of the category selected in the service area entry.

    Here is some simplified sample code:

    {exp:channel:entries channel="service_area" limit="1" }
    
    <h2>Service</h2>
    <p>{title}<br />
    {service_area_description}</p>
    
    <h2>Our Staff in this area</h2>
    <p>{ key_people}<br />
    <li>{key_person_list}<a href="http://{page_uri}">{person_name}</a>{/key_person_list}</li><br />
    {/key_people}</p>
    
    <h2>Articles</h2>
    <p>{exp:channel:entries channel="articles" limit="5" dynamic="no"}<br />
    {categories}<br />
    <li><a href="http://{page_uri}">{title}</a></li><br />
    {/categories}<br />
    {/exp:channel:entries}</p>
    
    <p>{/exp:channel:entries}

    The template referenced above is been re-used via the pages module to approx 20 services they specialise in so I can’t hard code the category code so it only shows the “fund” articles.

    Any ideas how we can edit those snippets so that only the “funds” articles will dynamically appear?

     

  • #2 / Jul 30, 2012 5:18pm

    Robin Sowell

    13255 posts

    Ah- I was going to say ‘remove the dynamic param’ so it could pick up the category indicator in the url and you’d be fine.  Which is true- except I just figured out you’re probably on a single entry page here rather than a traditional category page.

    In which case- would the related_categories_mode parameter do the trick?  I suspect it would- though note, don’t nest your channel entry tags w/this approach.  Or at all, really.

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

ExpressionEngine News!

#eecms, #events, #releases