I may be crazy, but I believe I have been able to get the basic functionality of Nested URLS in a module with only 2 modifications to the core of sapphire.
Goals:
- As little change possible to the core of SilverStripe (cms, jsparty, sapphire)
- To separate navigation/Sitetree structure with URL structure
- Ability to toggle nested urls
This requires SilverStripe 2.3+
To Install:
1. Make the following changes to your SilverStripe installation:
Index: sapphire/core/control/HTTPRequest.php
===================================================================
--- sapphire/core/control/HTTPRequest.php
+++ sapphire/core/control/HTTPRequest.php
@@ -364,7 +364,10 @@
if($arguments === array()) $arguments['_matched'] = true;
return $arguments;
}
-
+
+ function setParams($params){
+ $this->allParams = $params;
+ }
function allParams() {
return $this->allParams;
}
Index: sapphire/core/model/SiteTree.php
===================================================================
--- sapphire/core/model/SiteTree.php
+++ sapphire/core/model/SiteTree.php
@@ -236,6 +236,10 @@
$action = "";
}
if($this->URLSegment == 'home' && !$action) return Director::baseURL();
+ $result = $this->extend('Link',$action);
+ if($result){
+ return $result[0];
+ }
else return Director::baseURL() . $this->URLSegment . "/$action";
}
2. Extract the module tar.gz into the base of you SilverStripe directory so that
/nestedurls is parallel with /cms and /sapphire
3. Run /dev/build?flush=1
4. All done! You should know have nested urls!
5. Leave a comment or email me if you have any suggestions to change the code/make improvements/fix a bug/etc…
LinkedIn
OSU:pro
Hey There,
I’ve been working on adding fully fledged nested URL support to SilverStripe. Another person involved with the project suggested I post some quick information about where it’s currently at.
The actual implementation is complete, with only 1 issue left to close before it’s merged back into trunk (to do with broken link management). It’s been used for a few sites, including one by the SilverStripe core team (metlinkmelbourne.com.au). You can check the code out at http://github.com/ajshort/sapphire/tree/nestedurls and http://github.com/ajshort/jsparty/tree/nestedurls.
If you want to be informed of progress, you can either follow me on GitHub or cc yourself in at http://open.silverstripe.org/ticket/2508.
Thanks,
Andrew Short
Many thanks for this module, it saved the day big time at my company.
Peter