Silverstripe is one small community that is remarkably growing with the passing time. And AddWeb, having sensed its strength, had picked it quite some time back. Just after having worked on a handful of Silverstripe projects, we started giving it back to the community in whichever way that we can - modules, patches, blogs, et al. Yes, previously also we’ve shared SilverStripe Blogs on the rich bank of modules and themes available in SilverStripe, How to operate the administrative panel of SilverStripe CMS and how powerful is this platform called SilverStripe.
Now, let’s start with sharing some technical tutorials. To start with, we’ll like to share the detailed directory structure in Silverstripe.
In SilverStripe, the directory structure is built on the convention rather than the configuration, which is why the placement of certain files and directories is pretty logical in general. There are various sub-structures and even further divisions of the same, fall under the directory structure in SilverStripe. Let talk about the Code Structure first and the sub-structures of the same.
Code Structure :
This directory contains all the codes that define the website.
Web Server public webroot.
Images and other files are uploaded via CMS into this folder. You can also keep your own files and images in this folder.
Exposed public files are added from the module. Folders within this parent will match that with the source root location.
SilverStripe modules and libraries are stored in this folder. (the framework is in vendor/SilverStripe/framework)
This is the standard theme location.
Customization of the Code:
This directory contains all the code that defines the website.
This directory contains YAML configuration specific, meant for the website.
This directory contains the PHP code for the model and the controller.
You can do PHP unit testing here by using this folder.
You can add your view i.e. the HTML files here with the .ss extension for the $default theme.
You can design the CSS files here.
Images used all over the website are saved here.
The more complex projects can alternatively contain frontend assets in a common client folder.
Theme Code Structure:
Custom theme directory differs a bit from the usual one. Here’s sharing details for the same.
Its a default standard theme provided by SilverStripe.
- themes/<your-theme name>:
Custom theme base directory.
- themes/<your-theme name>/templates:
Custom theme template.
- themes/<your-theme name>/CSS:
Custom theme CSS files.
Module Code Structure:
When you add some module to the website then its directory structure also changes. Hence, here’s sharing the details of the same.
Say, for instance, you installed the userform module. In that case, below would the module code structure for the same.
This directory contains all the codes for user-defined form.
This directory contains all the codes of every model, controller, and extension of the user defined forms.
This directory contains all the YAML files.
This directory contains all images which are used for the userform module.
Hope, you found this detailed Directory Structure in SilverStripe helpful. In case, by the end of the blog, you’ve come across a handful of queries, you can go ahead and share them with us. Also, feel free to share/add more knowledge on the same with us. Because it’s all about sharing with and for the community. Isn’t it?