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.

Permalink based on channel

January 05, 2011 11:33am

Subscribe [3]
  • #1 / Jan 05, 2011 11:33am

    doubleplusgood

    199 posts

    Hello,

    I’m currently pulling in entries from 2 channels on my homepage as follows;

    {exp:channel:entries channel="news|calendar_events" limit="4"}
    <h2 class="title"><a href="http://{title_permalink=">{title}</a></h2>
    {if summary}{summary}{if:elseif event_summary}{event_summary}
    {/exp:channel:entries}

    Because I am getting entries from 2 different channels, I want to ensure that the title_permalink will go to the appropriate page for that channel. I was wondering how I can achieve this?

    I thought about putting in some sort of if statement, based on the channel but it didn’t seem to work.

    I was wondering if anyone else had a solution?

    By the way, the editor here seems to be stripping out some of my code. The title_permalink is entered correctly as per the user guide;
    {title_permalink="news/view"}.

    Thanks,
    Neil

  • #2 / Jan 06, 2011 12:44am

    John Henry Donovan

    12339 posts

    Neil,

    You are probably better off using {comment_url_title_auto_path}. That way you can change the URL defined in each of the channel’s preferences


    You should also actually check for something in your conditionals rather than the syntax you used

    {exp:channel:entries channel="news|calendar_events" limit="4"}
    <h2 class="title"><a href="http://{comment_url_title_auto_path}">{title}</a></h2>
    {if summary != ""}{summary}{if:elseif event_summary !=""}{event_summary}{/if}
    {/exp:channel:entries}
  • #3 / Jan 06, 2011 7:41am

    doubleplusgood

    199 posts

    Hey John,

    That’s perfect. Thanks very much. :D

  • #4 / Jan 06, 2011 9:01am

    Ingmar

    29245 posts

    Glad to see John Henry was able to help. Please post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases