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?