Successfully reported this slideshow.

SilverStripe Framework - Building without the CMS

2

Share

Loading in …3
×
1 of 38
1 of 38

SilverStripe Framework - Building without the CMS

2

Share

Download to read offline

Description

Building without the SilverStripe CMS can be useful when you don't need full website management tools. Learn how to go about building a web-app with just the SilverStripe Framework

Transcript

  1. 1. SilverStripe Framework Building without the CMS
  2. 2. 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?
  3. 3. Why would you even... But the CMS is one of SilverStripe’s USPs!
  4. 4. Why would you even...
  5. 5. 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!
  6. 6. 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
  7. 7. So why throw it away? Speed gains Reduce bloat No requirement for managing site structure or content Highly dynamic pages
  8. 8. Where do we start?
  9. 9. Routing
  10. 10. Routing Config system for routing mysite/_config/routes.yml Define routes to controllers Before/After? Before = LOWER priority After = HIGHER priority
  11. 11. 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
  12. 12. Putting it into practice
  13. 13. A Todo App!
  14. 14. Nested controllers
  15. 15. Nested controllers Delegating to nested controllers Prevent creating GOD controllers Single purpose controllers! Flexibility to be used anywhere
  16. 16. Flexibility Instead of:
  17. 17. Flexibility We can do:
  18. 18. Routing through nested controllers GET /todo/1/task/9/delete HTTP/1.1 Host: example.com ... todo matches ListController 1/task/9/delete is passed to ListController 1/task matches task action 9/delete is passed to TaskController
  19. 19. Add some logic to pull out the current List
  20. 20. Put it all together...
  21. 21. Sprinkle some fairy dust
  22. 22. We have ourselves a todo list app
  23. 23. What about administration?
  24. 24. CRUD out of the box?
  25. 25. 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 The admin (not CMS)
  26. 26. CRUD out of the box?
  27. 27. 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 The admin (not CMS)
  28. 28. What did we learn?
  29. 29. Everything else stays the same Define your Routes Controllers Models Relationships Views
  30. 30. or… just build a to-do list app
  31. 31. Thanks github.com/dhensby/todo-list @dhensby (everywhere!!)

Description

Building without the SilverStripe CMS can be useful when you don't need full website management tools. Learn how to go about building a web-app with just the SilverStripe Framework

Transcript

  1. 1. SilverStripe Framework Building without the CMS
  2. 2. 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?
  3. 3. Why would you even... But the CMS is one of SilverStripe’s USPs!
  4. 4. Why would you even...
  5. 5. 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!
  6. 6. 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
  7. 7. So why throw it away? Speed gains Reduce bloat No requirement for managing site structure or content Highly dynamic pages
  8. 8. Where do we start?
  9. 9. Routing
  10. 10. Routing Config system for routing mysite/_config/routes.yml Define routes to controllers Before/After? Before = LOWER priority After = HIGHER priority
  11. 11. 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
  12. 12. Putting it into practice
  13. 13. A Todo App!
  14. 14. Nested controllers
  15. 15. Nested controllers Delegating to nested controllers Prevent creating GOD controllers Single purpose controllers! Flexibility to be used anywhere
  16. 16. Flexibility Instead of:
  17. 17. Flexibility We can do:
  18. 18. Routing through nested controllers GET /todo/1/task/9/delete HTTP/1.1 Host: example.com ... todo matches ListController 1/task/9/delete is passed to ListController 1/task matches task action 9/delete is passed to TaskController
  19. 19. Add some logic to pull out the current List
  20. 20. Put it all together...
  21. 21. Sprinkle some fairy dust
  22. 22. We have ourselves a todo list app
  23. 23. What about administration?
  24. 24. CRUD out of the box?
  25. 25. 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 The admin (not CMS)
  26. 26. CRUD out of the box?
  27. 27. 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 The admin (not CMS)
  28. 28. What did we learn?
  29. 29. Everything else stays the same Define your Routes Controllers Models Relationships Views
  30. 30. or… just build a to-do list app
  31. 31. Thanks github.com/dhensby/todo-list @dhensby (everywhere!!)

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

×