3

I'm wanting to allow my client to be able to create unlimited pages at the root of their site, for example, these will be used for confirmation pages etc:

http://www.url.com/test-page http://www.url.com/test-page2

I've created the following template using Switchee, however when I goto the url for the page I simply get a 404 page. I've created a "standard_items" channel and they have the url of test-page:

{exp:switchee variable="{segment_1}" parse="inward"}

  {case value=""} 

{embed="site/header" page_name="home"}

<!-- Homepage -->

{exp:channel:entries channel="home" limit="1"}
<h1>{title}</h1>
{/exp:channel:entries}

  {/case}

  {case default="yes"}

{embed="site/header" page_name="detail"} <!-- Standard page -->

  {exp:channel:entries channel="standard_item"}

    <h1>{title}</h1>
    {introduction}
    {image}
      <div class="image">
        <img src="{url:portrait}" alt="{title}" width="196" height="224" />
      </div>
    {/image}
    {body}

  {/exp:channel:entries}

  {/case}
{/exp:switchee}

{embed="site/footer"}

Any idea why?

5

This is likely because you've enabled strict URLs in your Template Preferences, which means that the first segment of your URL must be a valid template group. Disabling strict URLs will allow you to proceed.

I would suggest, however, that rather than the approach you're taking, make your standard_item channel the default channel for the Pages module (and choose a default template for new entries in that channel), and instruct your clients to use not the URL Title field, but the Pages URI field.

This way your home page template is bypassed altogether (loading the selected page template directly), and you can ditch the Switchee approach. Much cleaner and more future-proof.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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