3

At the moment I'm strugling with the pages module and the page uri. I have the following page created with the pages module:

members
 |- members/calendar
 |- members/safety

When I visit the URL www.mypage.com/members I will see the correct page.

When I visit the URL www.mypage.com/members/calendar, I will see the correct page.

But when I visit the URL www.mypage.com/members/calendar/2013-12, the /members page is shown.

But I need the calendar page and the last segment is a kind of variable. I use the Low Events calandar on the calandar page. Strict URL is "off".

If I put a question mark in the url www.mypage.com/members/calendar/?2013-12 the calandar is shown, but now there is no segment_3 that I can use in selecting the month in the low events calendar.

How do I fix this issue?

1
  • I fixed my issue by enabling php en getting the month as a parameter. Don't think that this should be the way to do this, so I will keep the question open for now.
    – Timo002
    Commented Nov 4, 2013 at 9:12

2 Answers 2

4

This is what the Template Routes add-on was made for. In your EE config.php, add your template routes config:

$config['template_routes'] = array(
  ':page:XX/(\d{4}-\d{2})' => 'site/member-calendar',
);

where XX is the entry_id of the members/calendar entry and 'site/member-calendar' is the template_group/template_name of your template.

1
  • Great add-on! Thank Rob, I could fix it with this add-on without the need of enabling php en create "ugly" URL's.
    – Timo002
    Commented Nov 4, 2013 at 20:04
3

Since you want the page content to be dynamic and not static the proper way to do this would be via the regular ExpressionEngine group/template/entry url parsing structure.

The Pages module is really for making "static" content. It looks for specific URLs and will not look for partial URLs then take the remainder as parameters - this is what the normal URL parsing is for.

Why are you using it in preference for the "normal" method in this case?

Because there is no Pages URL for /members/calendar/2013-12 the system defaults back to regular URL parsing which is why you get the members page.

Your Answer

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

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