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.

Problem with nested category tags

August 28, 2012 3:33am

Subscribe [2]
  • #1 / Aug 28, 2012 3:33am

    misc

    54 posts

    Dear EE team

    I have the following situation on a category page:

    {exp:channel:category_heading channel="main"}
        {exp:channel:entries channel="main" limit="10"}
           {categories}
             {category_name}
           {/categories}
        {exp:channel:entries}
    {/exp:channel:category_heading}

    Now, the ‘category_name’ tag shows always the name of the active category (dynamicly by category page), not the categories the entry belongs to.

    A possible solution would be:

    {exp:channel:category_heading channel="main"}
    {/exp:channel:category_heading}
    
        {exp:channel:entries channel="main" limit="10"}
           {categories}
             {category_name}
           {/categories}
        {exp:channel:entries}
    
    {exp:channel:category_heading channel="main"}
    {/exp:channel:category_heading}

    But this solutions seems to be not very efficient (I suppose that this will need more sql queries).

    Thank you very much for your support.

    MISC

     

  • #2 / Aug 28, 2012 10:52am

    Shane Eckert

    7174 posts

    Hey misc,

    Thank you for posting your question here on the ExpressionEngine forums.

    What is the purpose of the last code block? The header and the channel entries loop make sense, but not sure what the last block is for.

    Actually, let’s back up. Can you show me an example of what you are trying to accomplish and then I can try to show you how. Make sense?

    Thank you,

  • #3 / Aug 29, 2012 4:45am

    misc

    54 posts

    Dear Shane

    In the last code block, I need the Category Id as a value for a plugin parameter:

    {exp:channel:category_heading channel="main"}
        {category_name}
        {category_description}
    {/exp:channel:category_heading}
    
        {exp:channel:entries channel="main" limit="10"}
           {categories}
             {category_name}
           {/categories}
        {exp:channel:entries}
    
    {exp:channel:category_heading channel="main"}
         {exp:amz:list node_id = "{category_id}"}
         ....
         {/exp:amz:list}
    {/exp:channel:category_heading}
  • #4 / Aug 29, 2012 3:44pm

    Shane Eckert

    7174 posts

    Hey misc,

    Gotcha.

    From what I understand in the middle block you would like the entry and the category it belongs to, correct?

    {exp:channel:entries channel="main" limit="10"}
    {title} belongs to the category {category}
    
    
    {content}
    
    
    {exp:channel:entries}

    Would that work for you?

    Cheers,

  • #5 / Aug 29, 2012 3:47pm

    misc

    54 posts

    Yes, that is correct.

  • #6 / Aug 30, 2012 11:47am

    Shane Eckert

    7174 posts

    Hey misc,

    Awesome. So are you good to go?

    Thank you,

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

ExpressionEngine News!

#eecms, #events, #releases