silverstripe framework - building without the cms
TRANSCRIPT
![Page 1: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/1.jpg)
SilverStripe FrameworkBuilding without the CMS
![Page 2: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/2.jpg)
What we’ll cover
Why?! Just why?
What does the CMS take care of for us?
Setting up routes
Handing off to nested controllers
What about a CRUD* interface?
*Create, Read, Update, Delete
![Page 3: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/3.jpg)
Why would you even...
But the CMS is one of SilverStripe’s USPs!
![Page 4: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/4.jpg)
Why would you even...
![Page 5: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/5.jpg)
Because:
Quick to get up and running
Easy to define Data Model
Familiarity with framework
Can use existing pipelines and workflows
User management out-of-the-box
Access control / security
Modules!
![Page 6: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/6.jpg)
What does the CMS do?
Takes care of dynamic routing
ModelAsController
Nested routes
Dynamic links to models
Forwarding of old URLs
SiteTree
Pages
Logical hierarchy and menus
Managing Assets
Nice HTTP error templates
![Page 7: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/7.jpg)
So why throw it away?
Speed gains
Reduce bloat
No requirement for managing site structure or content
Highly dynamic pages
![Page 8: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/8.jpg)
Where do we start?
![Page 9: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/9.jpg)
Routing
![Page 10: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/10.jpg)
Routing
Config system for routing
mysite/_config/routes.yml
Define routes to controllers
Before/After?
Before = LOWER priority
After = HIGHER priority
![Page 11: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/11.jpg)
Routing
Handling requests on the Controller
Extra params won’t be removed
Params are parsed when they match
We can create some nice “RESTful” URIs
![Page 12: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/12.jpg)
Putting it into practice
![Page 13: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/13.jpg)
![Page 14: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/14.jpg)
A Todo App!
![Page 15: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/15.jpg)
![Page 16: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/16.jpg)
![Page 17: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/17.jpg)
![Page 18: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/18.jpg)
Nested controllers
![Page 19: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/19.jpg)
Nested controllers
Delegating to nested controllers
Prevent creating GOD controllers
Single purpose controllers!
Flexibility to be used anywhere
![Page 20: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/20.jpg)
Flexibility
Instead of:
![Page 21: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/21.jpg)
Flexibility
We can do:
![Page 22: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/22.jpg)
Routing through nested controllers
GET /todo/1/task/9/delete HTTP/1.1Host: example.com...
todo matches ListController
1/task/9/delete is passed to ListController
1/task matches task action
9/delete is passed to TaskController
![Page 23: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/23.jpg)
Add some logic to pull out the current List
![Page 24: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/24.jpg)
Put it all together...
![Page 25: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/25.jpg)
Sprinkle some fairy dust
![Page 26: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/26.jpg)
We have ourselves a todo list app
![Page 27: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/27.jpg)
What about administration?
![Page 28: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/28.jpg)
CRUD out of the box?
![Page 29: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/29.jpg)
Framework comes with the admin module
CMS extends Admin
Most projects/apps need SOME sort of CRUD interface
Save yourself building an admin interface!
User management / permissions out of the box
Speed up testing
The admin (not CMS)
![Page 30: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/30.jpg)
![Page 31: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/31.jpg)
CRUD out of the box?
![Page 32: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/32.jpg)
![Page 33: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/33.jpg)
Framework comes with the admin module
CMS extends Admin
Most projects/apps need SOME sort of CRUD interface
Save yourself building an admin interface!
User management / permissions out of the box
Speed up testing
The admin (not CMS)
![Page 34: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/34.jpg)
What did we learn?
![Page 35: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/35.jpg)
![Page 36: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/36.jpg)
Everything else stays the same
Define your
Routes
Controllers
Models
Relationships
Views
Forms
Change the world!
![Page 37: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/37.jpg)
or… just build a to-do list app
![Page 38: SilverStripe Framework - Building without the CMS](https://reader036.vdocuments.mx/reader036/viewer/2022062412/58f360001a28abb56d8b45db/html5/thumbnails/38.jpg)
Thanksgithub.com/dhensby/todo-list
@dhensby (everywhere!!)