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.

How to Capture Channel Variable and Parse to Secondary Channel in Template

July 09, 2010 2:04am

Subscribe [1]
  • #1 / Jul 09, 2010 2:04am

    Robert Mirabito

    58 posts

    Is this possible. I’ll try to explain what I’m doing. Maybe there is a better way. 😊

    Below is some example code of a template I want to create. There are two channels, each with different data but they both use the same custom category group. The template group is the default for channel1. I want to be able to include entries from channel2 in the template below the channel1 content.

    Can I capture the category from the entry in channel1 and use that as the category id for channel2?

    <html>
    <head>
        <title>My cool EE website</title>
    </head>
    <body>
        
        {exp:channel:entries channel="channel1" limit="1" }
            <h1>{title}</h1>
            {channel1-content}
        {/exp:entries}
        
        {exp:channel:entries channel="channel2" limit="5" category="{channel1-category-id}"}
            {title}
            {custom-field-1}
            {custom-field-2}
            {custom-field-3}
            <hr >
        {/exp:channel:entries}
        
    </body>
    </html>
  • #2 / Jul 09, 2010 9:42am

    ender

    1644 posts

    have you tried the related_categories_mode parameter?  seems like that might take care of what you’re trying to do here.

  • #3 / Jul 11, 2010 10:40pm

    Robert Mirabito

    58 posts

    I’m going to take a look at this today and see if this is a good fit for what I’m trying to do.

  • #4 / Jul 12, 2010 1:48am

    Robert Mirabito

    58 posts

    Ender,

    Thanks for suggesting the related_categories_mode.  That seems to be doing what I need to do.

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

ExpressionEngine News!

#eecms, #events, #releases