0

I'm using Expression Engine 2.7.2 and Structure 3.3.17 and am having a problem creating a nested URL structure.

I have one Channel "Landing Pages" whose entries point to the template /region/index and calls the page content like so:

{exp:channel:entries disable="member_data|pagination" url_title="{last_segment}" limit="1" channel="landing_page" cache="yes" refresh="1500"} 

    {if no_results}
        {redirect="404"}
    {/if} 

    OUTPUT CONTENT.... 

{/exp:channel:entries}

I have created two test entries:

Wellington Landing Page (URL title and 'Structure URL title' both "wellington") - this page is able to be viewed as expected at /region/wellington/

Wellington Kitchens Landing Page (URL title and Structure URL title both "kitchen"). This page has "Wellington Landing Page" specified as its Structure Parent Entry. We need to be able to view this below its parent page in the URL structure, that is at /region/wellington/kitchen/ however this returns 404. It is possible to view it at /region/anyrandomtext/kitchen/ or /region/kitchen/

I have tried replacing the {exp:channel:entries} tag with {exp:structure:entries} and the problem persists.

Is this something that should work? Any suggestions would be much appreciated.

1
  • Where is /kitchens positioned within the Structure tree? Is it a child of /wellington? And, is the value in the "Structure Page URL" field (under the Structure tab} 'kitchens'?
    – dbigca
    Sep 21, 2015 at 18:59

1 Answer 1

0

I normally use something else for this kind of cases. Maybe a bit more cunbersome, but works great. You'll need Switchee for this

{exp:switchee variable="{segment_1}" parse="inward"}
    {case value="#^P(\\d+)$#|''"}
        segment_1 is empty, get the main page
    {/case}
    {case default="Yes"}
        segment_1 is not empty, so let's first see if there is any more segments  
        {switchee variable="{triggers:segment_2}" parse="inward"}
            {case value="#^P(\\d+)$#|''"}
            No, the second segment is empty. display the region info
            {/case}
            {case default="Yes"}
                Segment_2 is not empty, check if there are other segments first
                {switchee variable="{triggers:segment_3}" parse="inward"}
                    {case value="#^P(\\d+)$#|''"}
                    Segment_3 is empty, display the wellington info
                        {exp:channel:entries disable="member_data|pagination" url_title="{segment_2}" limit="1" channel="landing_page" cache="yes" refresh="1500"}
                        {/exp:channel:entries}
                    {/case}
                    {case default="Yes"}
                        Segment_3 is not empty, display the city info (Kitchen)
                        {exp:channel:entries disable="member_data|pagination" url_title="{segment_3}" limit="1" channel="landing_page" cache="yes" refresh="1500"}
                        {/exp:channel:entries}
                    {/case}
                {/switchee}
            {/case}
        {/switchee}
    {/case}
{/exp:switchee}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.