Tips on Upgrading to Silverstripe CMS version 2.4

I just switched to Silverstripe 2.4+ and came accross several changes in contrast with SS2.3+. I'm gonna list here few of those changes so you guys will be aware of them. And I pledge to update this from time to time. Hopefully, this will guide you when you finally decide to upgrade your old version. Or this might as well motivate you to upgrade like me.

One of my reasons why I badly need to upgrade my old version was this. In 2.3, I just couldn't do this. Here's what SS Team had to say about this feature:
...the nested URLs feature means that your site URLs now reflect the actual parent/child page structure of your site. In SilverStripe 2.3 and earlier, all page URLs would be on the top level, regardless of whether they were nested under other pages or not. In 2.4 however, the URLs now map directly to the chain of parent and child pages

To enable this feature in your SS application, go to mysite folder, and open _config.php file. Add the following code.
// Enable Nested Urls in SS2.4
if (!SiteTree::nested_urls())

Not really. In 2.4+, they switch this feature off by default. Perhaps they realized that not all applications built on SS use this feature.

For you to enable this functionality, here's what you need to do. Go to mysite folder and look for _config.php file. Open this up and type in the following:
// Enable Search in SS2.4+

In 2.4+, template paths are nowhere to be seen by default. Template Paths are those paths visible when you are running your application in Dev mode. If that's not enough, go to a page in your app, right-click your mouse and hit View-Source. You'll see long file paths along the markups.

Now here's the code you'll paste in mysite/_config.php file.

To see the changes, clear the cache like this:

Tip: To add a comment into a template file, like if you want to document it, then use this (when your application is viewed in Published site, these comments won't be shown):
<%-- put your comments here --%>

That's it for now. As I've said, I'll update this article from time to time and as long as it's something valuable for us, I'll put them here. You could visit the blog every now and then or you could subscribe to my RSS feed for updates and new posts.

Thanks for reading. =]

Related Posts:

Bookmark and Share


Post a Comment

Hi there! Please leave your message here. Also, I may not be able to respond to your query right away. So please bear with me. Thanks. :)