Hey Everyone,
As you may be aware, I've been working on adding nested URL support to
SilverStripe for the last
three months (
site.com/page/sub-page/). I've been meaning to send out
a quick status update for
a while, so here it finally is!
IMPLEMENTATION
* Nested URLs are disabled by default, and you can enable them by
adding
"SiteTree::enable_nested_urls()" in your _config.php file
* The entire system is built on SiteTree::get_by_link() which allows
you
to pass in almost any valid link and get a SiteTree object back
* Conflicts are resolved automatically, either when theres both a
ParentID
and URLSegment conflict, or when theres an $allowed_actions
conflict on
a parent controller
* You can pretty easily upgrade an old site to run with the
nestedurls
branch - all your old non-nested links will automatically be
rewritten
and redirected
* Most functions (the linkorsection stuff, Link(), RelativeLink())
still
work just as before, with some minor changes. Now, if you need to
use a
CSS class unique to a page, you use $ElementName instead of
$URLSegment
PROGRESS SO FAR
Currently, the actual implementation of the nested URL stuff is pretty
much done, and is partially
supported by tests. All the base functionality seems to work fine, and
you can switch pretty easily
between nested & non-nested URLs. I would say that, as long as you
have an advanced knowledge of
OOP PHP, you could get away with using the nestedurls branch for
projects which don't require things
like the subsites module (note that all modules are untested with the
branch).
Note: for a commit log you can visit
http://open.silverstripe.com/log/modules/sapphire/branches/nestedurls
TODO
* The link tracking and inserting stuff is going to be rewritten as
part
of the nestedurls branch in order to allow for easier tracking and
more
resilient linking. Rather than just writing out a plain link, the
link
inserted will be updated to use links like "$Link[ID]"
This will then be translated into a real link at runtime using an
escaping
method. This means that links will automatically update when moving
pages,
renaming them etc. It also means that links will only be broken
when the
pages are deleted - and broken links can be managed much more
easily.
* Write lots of tests, as well as manual testing with some of the
modules