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
2 comments so far
Add Your Comment