Hi All,
Good news, I have moved the nested url module to github:
http://github.com/jamespaulmuir/nestedurls
I have been testing the nestedurl module (by writing unit/functional test) and hope to push those to github. As I forgot to mention in my last post about this module, huge props to Andrew Short ( http://the-short.com/ ) for inspiring this module.
Here’s the story:
OSU Libraries have been using code from Andrew’s nested URL branch by creating a diff of his changes, stripping out the non-nestedurl changes, and applying the diff to the stable releases of SilverStripe. We’ve gone from 2.2.2 up to 2.3.3 using the special diff that was created. The reason was because OSU Libraries cannot be running an unstable branch of code on our production site! As of recently, we’ve been having a lot of problems with the nested URLs branch, so it was time to step back and re-evaluate. So, one weekend I sat down with a fresh copy of SilverStripe 2.3.3 and started coding. A few hours later, this module was born. (Again, I can’t say this enough, THANKS Andrew Short for your inspiration for this!).
I wanted to see if this functionality could be put into SilverStripe while changing as little code in sapphire, cms, and jsparty as possible and being very simple so that SilverStripe can be easily updated. I do believe that this module will be fully featured with a new cool feature (more on that in the next section). The changes that I’ve made to the core are just adding some utility (added a setter for allParams to HTTPRequest, and an extend call in SiteTree->Link() … see previous post about nestedurls)
By simply extending SiteTree by adding a field called URLParent, nested URL functionality can be done and also another important feature: The ability to control the entire url structure of your SilverStripe site that is independent from the SiteTree/Menu structure.
For example:
At the Libraries, here is a portion of our Site Tree:
- About
- Departments
- Web Implementation Team (WIT)
- Committees
- Web Visioning Committee (WVC)
So normally without Nested URLS, these pages would be:
- /about
- /departments
- /WIT
- /committees
- /WVC
And with nestedurls (using my module, or Andrew Short’s nestedurl branch):
- /about
- /about/departments
- /about/departments/WIT
- /about/committees
- /about/committees/WVC
Now, with the new feature of my nestedurl module, I can set the URLParent fields for the following:
- Departments: set URLParent = 0 (root of site)
- Committees: set URLParent = 0 (root of site)
And the result is the following:
- /about
- /departments
- /departments/WIT
- /committees
- /committees/WVC
By default, if there is no URLParent field set for a given page, it will use the Parent field to determine the preceding URL segment. So as you can see, the URLs for WIT (department), and WVC (committee) are nested with departments and committees, respectively, because these page have a NULL value for URLParent so the normal Parent field is used. The “parent url” for committees and departments have been overridden by the URLParent field that we set to 0 earlier (so they jump to the root of the site).
In summary, this module is still under development, and is currently being tested with other modules (googlesitemaps, userforms, dataobjectmanager, imagegallery). I now have the module on Github to track changes and issues. If anyone would like to contribute to this module, let me know! Thanks so much for reading.