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.

Two channels posting to shared categories, can't figure out proper links in categories/archives

April 04, 2013 10:35pm

Subscribe [2]
  • #1 / Apr 04, 2013 10:35pm

    helbnt

    143 posts

    (x-posted from stackexchange, so sorry if you read this over there. And I’m still explaining this poorly…)

    I have two different blogs (Blog and Featured), two different category groups (Blog and Decades), and I’m having a problem linking items in my category and archive groups and to the correct page.

    If I’m allowed to use multiple channels in the channel= parameter, what do I link the {category_name} to? Either blog can select the Decades Category group, so if I want someone to see all the posts in the 1910 category (under the Decades category group), regardless if the post was made in the blog channel or the featured channel, how would I go about it?

    Here’s an example of the snippet in my sidebar:

    <h3>DECADES</h3>
    <p><ul><br />
        {exp:channel:categories channel="blog|featured" style="linear" category_group="not 10"     show_empty="no"}<br />
        <li><a href="http://">{category_name}</a></li><br />
        {/exp:channel:categories}<br />
    </ul></p>
    
    <h3>ARCHIVES</h3>
    <p><ul><br />
        {exp:channel:month_links channel="blog|featured"}<br />
        <li {if segment_2==year AND segment_3==month_num}class="active"{/if}><a href="http://{path=blog}">{month} {year}</a></li><br />
        {/exp:channel:month_links}<br />
        {if segment_2 !="category" AND segment_3 !=""}<br />
        <li><a href="http://{path=weblog}">All Entries</a></li><br />
        {/if}<br />
    </ul>


    If it matters, I’m using Switchee in my main template (and I think I have that working - for the most part).

  • #2 / Apr 08, 2013 4:26pm

    Rob Allen

    3105 posts

    You need to set a template path so EE can work out the category link

    So assuming you have a template called ‘archive’ in your /blog template group, and e template called ‘archive’ in your /featured template group, you could try something like this:

    {exp:channel:categories channel="blog|featured" style="linear" category_group="not 10" show_empty="no"}
    {if channel == "blog"}
    <li><a href="http://{path=blog/archive}">{category_name}</a></li>
    {/if}
    {if channel == "featured"}
    <li><a href="http://{path=featured/archive}">{category_name}</a></li>
    {/if}
    {/exp:channel:categories}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases