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 retrieving two channels

July 06, 2012 2:00pm

Subscribe [1]
  • #1 / Jul 06, 2012 2:00pm

    billuk

    2 posts

    I have a controller template which depending on segments will display a different template:

    {if segment_3 ==''}{embed="pages/.pages_index" category_id="{embed:category_id}"}
    {if:elseif segment_3 =="index.php"}{redirect='{segment_1}/{segment_2} '}
    {if:else}{embed="pages/.pages_article" category_id="{embed:category_id}"}{/if}

    In the .pages_index content template I have: (simplified)

    {exp:channel:entries channel="pages_info" url_title="{segment_2}"}
    {if no_results} {redirect="404"}{/if}
    Page things here…
    {/exp:channel:entries}

    In the .pages_article template I have: (simplified)

    {exp:channel:entries channel="pages_info" url_title="{segment_2}"}
    {if no_results} nothing here{/if}
    Page info things here
    {/exp:channel:entries}
    
    {exp:channel:entries channel="pages" url_title="{segment_3}"}
     {if no_results} {redirect="404"} {/if}
      Rest of page things here
    {/exp:channel:entries}

    The strange thing is that in the .pages_article template the pages_info channel doesn’t have any entries (which it does), but in the .pages_index template the entry shows up correctly.

    I’m stumped, any ideas what I’m doing wrong?

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

ExpressionEngine News!

#eecms, #events, #releases