Customizable URL patterns in the core
Trustmaster |
|
---|---|
This feature is proposed for the following benefits:
[list=1] Well, if you want to see an example how it would work, here it is. Call: 'SOME_TPL_URL' => sed_link('page', array('al' => 'some_title', 'comments' => 1)) /pages/some_title.htm?comments=1Result with pattern2: http://page.mysite.com/some_title/comments-1.htm I don't mean it will work this way, but just to give you an idea what we will discuss here. So, the URL gateway consists of the following parts: [list=1] Looks easy so far, but it's not so easy when it comes to API design. First we could create a separate function for each site area, e.g. (the example is taken from one of existing solutions):
It's quite easy at first but keep in mind that we need tens of such functions to cover all site areas, and this number is likely to grow with plugins, and these functions will be requested to be pluggable themselves later on. Another approach is having 1 generic function, which takes a pattern (from config) and URL parameters (as its arguments) and assembles an URL by following some common rules. Most probably some people will request for custom logic for exact site areas, so we could make it pluggable/customizable somehow (but I'm afraid it affects performance). Sorry, I'm not a good explainer this time, because I've caught a cold and it's hard to concentrate. But I hope it's enough for you to start posting your ideas. May the Source be with you!
|