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.

Related Entries w/ Categories

March 10, 2011 8:17pm

Subscribe [1]
  • #1 / Mar 10, 2011 8:17pm

    mklaman

    23 posts

    Hey guys,

    wondering if anyone could point me in the right direction with this. this is what i have which is overwhelming and confusing me!

    the page displays 2 awards (Player of the Week and All Rookie) and each athlete can be associated with a category which is their sport.

    i have an awards channel and an athletes channel.
    now i also want to show just one sport at a time (will use show/hide js) so i have a list of the categories of sports.

    i get all categories showing up in both awards even though there is no “hockey” in the one category.

    how do i limit the visible categories to just what sports are populated for that award?

    here is a screen grab of how i WANT it to work: http://d.pr/zAPT
    currently ALL sports show for both awards categories lists.

    my code:

    {exp:channel:entries channel="awards"}
                <div class="grid_12 alpha">
                    {related_entries id="wbasketball"}
                    <div class="mbasketball">
                        {title}
                    </div>
                    {/related_entries}
                
                    {related_entries id="mbasketball"}
                    <div class="wbasketball">
                        {title}
                    </div>
                    {/related_entries}
                </div>
                <div class="grid_4 omega">
                    <h3>{title}</h3>
    <p>                <ul><br />
                        {exp:channel:categories channel="athletes" show_empty="no"}<br />
                        <li><a href="#">{category_name}</a></li><br />
                        {/exp:channel:categories}<br />
                    </ul><br />
                </div><br />
                {/exp:channel:entries}

  • #2 / Mar 10, 2011 9:38pm

    Cheif

    626 posts

    So u want to show all categories and only highlight the one currently being viewed ?

  • #3 / Mar 10, 2011 11:59pm

    mklaman

    23 posts

    i will want to set class “active” to the visible one a well, but that’s not my questions regarding this post!

    my question is:

    how can i only have the categories that have content for that award to show up? currently both awards show ALL categories.
    example: if for “award 1” i have only “basketball and soccer” and for “award two,” i have “basketball and hockey.” hockey still shows as a category for award 1 even though it’s only supposed to be grouped w/ award 2.

    does that make sense?
    thanks for the help!

  • #4 / Mar 11, 2011 12:19am

    Cheif

    626 posts

    What happens if you pull the channel:categories tags outside the channel:entries tag ?

    ON re:reading the use of the categories tag, I believe what you’re seeing is correct as I imagine you’ve assigned the same category group to both POW & ROW - so in effect there are entries associated with the categories albeit not in the same channel.

  • #5 / Mar 11, 2011 8:46am

    mklaman

    23 posts

    yea i think it is displaying correctly as well.

    not sure how i do what i am shooting for since the athletes profile (athletes channel) is what holds the categorys and not the awards channel. hmmm

    thanks for the help

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

ExpressionEngine News!

#eecms, #events, #releases