1

I am still not 100% familiar with the newer relationships method added in 2.6 and I am wondering if I can get the Channel Category Archive Tag {exp:channel:category_archive} working with a parent relationship. It's for the table of contents of a monthly magazine, and I want the category heading and the entries listed below. The parent being the issue number.

Something like:

Category

  • Article 1
  • Article 2

Category

  • Article 3
  • Article 4

I've been playing with various combinations and no luck:

{exp:channel:entries channel="print_editions" disable="pagination" limit="1"}

  {exp:channel:category_archive channel="articles" style="linear" show_empty="no" status="not closed"}
    {parents}
      <h2>{parents:categories}{category_name}{/parents:categories}</h2>
       <ul>
        {parents:entry_titles}
         <li>{parents:title}<li>    
        {/parents:entry_titles} 
       </ul>
    {/parents}
  {/exp:channel:category_archive}
{/exp:channel:entries}
1

I feel your pain with EE relationships. I wrote up a good bit on the method we use here.

It was for product-buyers relationship paths, but is the same concept and I do certainly feel like you can get done what you need to here.

It can be done without the :search param in channel entries, I think under EE 2.6.... But it requires some well thought out plugin design.

Anyway, i'll leave this here and I do hope that it helps you.

https://expressionengine.stackexchange.com/a/18229/1872

0

I don't know that I completely follow what you are after, but it looks like a nasty little ditty.

Without knowing how everything is set up, you might be able to try using embeds to toss the data around like you need it. I haven't tested any of this, but it looks like it would do what you need.

In your main template:

{exp:channel:entries 
    channel="print_editions" 
    disable="pagination" 
    limit="1"
}
    {parents}
        <h2>{parents:categories}{category_name}{/parents:categories}</h2>
        <ul>
            {embed="template_group/category-archive-data-template" 
                entryID="{entry_id}" 
                entryChannel="{channel}" 
                archiveChannel="articles"
            }
        </ul>
    {/parents}

{/exp:channel:entries}

Then the 'category-archive-data-template' could have:

{exp:channel:category_archive 
    channel="{embed:archiveChannel}" 
    style="linear" 
    show_empty="no" 
    status="not closed"
}
    {embed="template_group/back-to-parent-relationship-data" 
        categoryID="{categories}{category_id}{/categories}" 
        entryChannel="{embed:entryChannel}" 
        entryID="{embed:entryID}"
    }
{/exp:channel:category_archive}

Then in the 'back-to-parent-relationship-data' you could do the following:

{exp:channel:entries 
    channel="{embed:entryChannel}" 
    entry_id="{embed:entryID}" 
    category="{embed:categoryID}" 
    disable="pagination"
}
    {parents}
        {parents:entry_titles}
            <li>{parents:title}<li>    
        {/parents:entry_titles} 
    {/parents}
{/exp:channel:entries}
1
  • Thanks, I'll consider it, but from a performance standpoint, I could likely do a couple channel entry loops filtered by category instead. There is an easier way, I was close with the code I posted, so it can be done, it's just refining the way it's written. For ref: ellislab.com/expressionengine/user-guide/modules/channel/…
    – Jeremy
    Jan 28 '14 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.