I’ve been an EE user for ~10 years, and this is a wrinkle that I keep coming back to. I think what I’m asking for just isn’t possible in EE-proper, but it’s also possible that I’m an idiot and am missing something obvious.
Back-story: I manage a large site, and I use the Pages module to create clear & consistent URL structure, down to typically three levels. Basically:
/section
/section/subsection
/section/subsection/page
Most pages are static, but I have a number of blog/news pages across the site. Some of the blog/news pages fit naturally at the 2nd-level, so it’s fine to refer directly to a template:
/section/blog
This allows me to use all of the dynamic URL parameters, e.g.:
/section/blog/P5
/section/blog/url_title
HOWEVER, in a few cases, the blog/news pages fit most naturally at the 3rd level:
/section/subsection/blog
and for clarity and consistency of URL structure, that’s where I’d like to put them. This would in theory create dynamic URLs like:
/section/subsection/blog/P5
/section/subsection/blog/url_title
It’s straightforward to use the Pages module to create a (blank) page which looks like
/section/subsection/blog
and which just points to a template which does the work, but the fact that the URL now has 3 segments baffles any handling of dynamic URLs. EE is (I assume) expecting any dynamic URL parameters to start at the 3rd segment, and doesn’t know that the Pages module has been used to extend the URL so that the dynamic parameters are later.
A possible, partial solution might I think be to pass the dynamic parameters as POST data, rather than in the URL (or GET data, I suppose), but this would require a lot of reinventing a wheel that’s already there, and I think there’d still be problems with, for example, promoting the URL to a specific entry, since all of the information would need to be in the URL, and this wouldn’t work:
/section/subsection/blog/url_title
SO. This feels like a very natural thing to want to do, but I’ve come back to it a number of times and haven’t found a good way in EE-proper (I’m not especially interested in 3rd party hacks or playing with .htaccess). Basically, the problem is how to use dynamic URL parameters when the base URL is more than 2 segments long. Has anyone tried to do something similar? Is there an obvious solution that I’m missing? Thanks!
ExpressionEngine doesn’t care what position in the URL a dynamic segment is in. But your template can be written in a way that might be preventing proper parsing of the expected segments. There could be other things at play as well. We’d need to take a look inside your install to get a better picture of what is happening, and how to solve it.
That said the pages module isn’t intended to be used for URL control. We recommend using templates and template routes for better URL control.
Thanks, James. My post was badly worded — I was really meaning to talk about how well/badly the Pages module plays with dynamic segments, however long the Pages module URLs are. I just happen to use the Pages module (among other things) to create 3-segment URLs.
My understanding from various places is that the Pages module is very limited with dynamic segments. The required use of dynamic=”no” pretty much kills any general support. But that’s okay. I do think that template routes are good solution for me here, so thanks for pointing me in that direction.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.