0

I am using Pages module and the Better Pages plugin on a site. When I navigate to the 'about' page, http:www/mydomain.com/about does not work and http://www.mydomain.com/about/index does.

Am I missing something in regards to how this is set up? Why do I have to include the template name with the template group? I didn't think the template name was required.

* EDIT * Using: EE 2.8.1 Better Pages 1.1.8

* EDIT *

My Pages URI is: /about

The following is my index template in the about template group.

{About/Index} Template Code

{!-- STASH SITE SETTINGS --}
    {stash:embed:partials:site_variables process="start" replace="yes" parse="yes"}
{!-- /STASH SITE SETTINGS --}

    {snippet--doctype-html-head}
    {snippet--core-head}

    <link rel="stylesheet" href="{site_url}css/skins/{exp:stash:get name='color'}.css">
    <body class="{exp:stash:get name='style'}">
        <div class="body">

        {!-- Header Router --}
            {exp:channel:entries
                channel="header"
                limit="1"
                disable='categories|member_data|pagination'
            }
                {!-- FIND THE TEMPLATE CHOSEN --}
                {exp:query
                    sql="SELECT template_name FROM exp_templates WHERE template_id = '{header_layout}' "
                }
                    {embed="Header/{template_name}"
                        rail_message="{rail_message}"
                        navigation_type="{navigation}{navigation:navigation_type}{/navigation}"
                        navee="{navigation}{navigation:navee}{/navigation}"
                        manual="{navigation}{navigation:manual}{/navigation}"
                        {if top_links:total_rows > 0}
                            top_links="TRUE"
                        {/if}
                    }
                {/exp:query}
            {/exp:channel:entries}
        {!-- /Header Router --}

        {!-- Page Router --}
            {exp:channel:entries
                channel="about"
                limit="1"
                disable='categories|member_data|pagination'
            }
                {!-- MUST HAVE ENTRY --}
                {if no_results}
                    {redirect="404"}
                {/if}

                {!-- FIND THE TEMPLATE CHOSEN --}
                {exp:query
                    sql="SELECT template_name FROM exp_templates WHERE template_id = '{page_layout}' "
                }
                    {embed="About/{template_name}"}
                {/exp:query}

            {/exp:channel:entries}
        {!-- /Page Router --}

        {!-- Footer Router --}
            {exp:channel:entries
                channel="footer"
                limit="1"
                disable='categories|member_data|pagination'
            }

                {!-- FIND THE TEMPLATE CHOSEN --}
                {exp:query
                    sql="SELECT template_name FROM exp_templates WHERE template_id = '{footer_layout}' "
                }
                    {embed="Footer/{template_name}"
                        banner="{banner_text}"
                        news_head="{newsletter_subscription_header}"
                        news_intro="{newsletter_lead_in_copy}"
                        twitter_head="{twitter_feed_header}"
                        contact_head="{contact_header}"
                        posts_head="{recent_posts_header}"
                        work_head="{recent_work_header}"
                    }
                {/exp:query}

            {/exp:channel:entries}
        {!-- /Footer Router --}

{!-- REQUIRED FOR PREVIEW --}
    {snippet--foot-constants}
{!-- /REQUIRED FOR PREVIEW --}
0

Better Pages doesn't actually affect the native functionality of Pages at all. It actually just a fieldtype that makes selecting the template/url a little easier by allowing the end user to filter down the list of available templates to those that are appropriate. BP doesn't affect the way Pages handles routing, or even intercept the way it adds it to the DB. It simply selects the correct options using JS.

If you go to the Pages tab and select the template/url that way, I suspect you will find that you have the same issue.

This isn't really an answer as much as a way to rule out that Better Pages would be doing anything funky with your routing. Hoping this helps narrow down your search for a solution.

| improve this answer | |
  • Thanks Michael. I'll update my post above to include the template code to see if anyone can rule out the issue. – W3bGuy Aug 28 '14 at 20:30
0

Ok, I was able to make this work by doing the following. Maybe I wasn't understanding completely how the Pages Module worked.

In my settings, I kept my default template as 'about/index', and modified the URL in the 'Custom URL' field to '/about/index'.

This allowed me to navigate to http://www.domain.com/about and see the dynamic content fed from the router template at http://www.domain.com/about/index.

| improve this answer | |
  • Good you have this working, but just to note that if you have a physical template at about/index, you don't need to use the pages module at all. Having that template by definition, means that the url domain.com/about will work (with or without index after it). – Tidy Aug 29 '14 at 9:03
  • The Pages module is for cases when you want to use URLs without having templates existing at those paths E.g. you could have a bunch of routine pages on your site which you want to access at /contact, /about, /about/history etc, which can all be covered by the same template you have set up at e.g. /site/page. You could then use the Pages module to set the same template for these entries, using the page url field to make them available at the desired URLs. – Tidy Aug 29 '14 at 9:10
  • Tidy. Thanks for the note. The reason I am using it this way, in this instance, was for the client to be able to build their pages using a templated set (hence Better Pages usage) in which they select a template for a particular (singular) page and are presented with a new set of entry criteria. This is allowing them to change the look and feel of their site with great ease. I am also using Single Entry to separate these pages from the rest of the more dynamic pages in the site. – W3bGuy Aug 29 '14 at 15:15

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.