SlideShare ist ein Scribd-Unternehmen logo
1 von 51
SILVERSTRIPE &
SAPPHIRE
From a Developer’s Perspective
About
• SilverStripe CMS is built on top of the Sapphire
framework
• Sapphire is a modular PHP 5, OOP, MVC framework with
lots of cool features
• Supports Apache and IIS equally well
• Can run on MySQL, SQLite, Postgres, MSSQL…
Structure
• Everything is a module
• Sapphire is the core module, with all (except for direct file
retrieval) requests routed through it
• The CMS is an module just like any other
• All code and theme assets (templates, css etc) are listed
in an automatically generated manifest - easy for the
system to find
Modules
• Module is simply a folder with a _config.php file
• Installation as simple as putting a folder in the root
directory and building the DB
• Defined points to hook into the base CMS functionality
using extensions
• Everything is a module, including your project code
MVC
Let’s look at each of those letters
MVC Definition
• Model – contains the behaviour and data of your
application. DataObjects and ORM.
• View – HTML, and other presentational elements. .ss
templates.
• Controller – responds to requests and binds the model to
the view. *_Controller classes.
Data
• You define your models as subclasses of DataObject
• Define your fields, relationships, and metadata on the
class, automatically built
• Uses multiple table inheritance
Defining Your Schema
• You define your database fields in a $db array
• Automatically pulls casting information from this
• Define relationships in their own array
• Visit or run /dev/build to rebuild the database
• Done!
Easy Relationship Management
• Several relationship types – has_one, belongs_to,
has_many, many_many, belongs_many_many
• Easy accessing:
• $this->Relationship($filter);
• $this->Relationship()->addMany($items)
• $this->Relationship()->map()
Page Types
• Complex DataObject, forms the core of most websites
• Managed via the main admin panel in the CMS
• Easy to customise, can contain any type of data
• Make SilverStripe ideal for your data, not the other way
around
• Each page type is coupled to its own controller
Retrieving Data
• Simple accessors – DataObject::get() and
DataObject::get_one()
• Can use SQLQuery and DB::query() to peek behind
the ORM
• Automatically caches certain things, performs default
sorts and allows hooking into the process
Changing Data
• $object->Field = $value
• $object->write()
• $object->publish(‘Stage’, ‘Live’)
• $object->delete()
Extensions (AKA Decorators)
• Add functionality to classes at runtime, without
subclassing
• Can add new methods, database fields, change and
enhance behaviour
• Many core processes have hooks that extensions can
hook in to
• Object::add_extension($subject, $extension)
Extensions Continued
• Add new database fields and form fields in the CMS
• Lock a user out if a third-party criteria is not met
• Change the permissions model to either force
permissions allowed or denied
• Add image editor support to the CMS image insertion
form
• Restrict content to a specific subsite
• Add extra fields to the member profile
• Add static caching to the publishing process
Core Extensions
• Versioned – adds support for staging/publishing, as well
as rolling back to specific versions
• Hierarchy – Allows for a tree of objects to be stored in the
DB, with related utiltity methods
• Translatable – Adds support for saving multiple languages
in one table, switch between languages, edit in CMS
Much more than just data
• Extensions can hook into all parts of SilverStripe
• Basically anywhere a developer calls
• $this->extend(‘methodName’) you can hook extra
behaviour in
Easy Forms
• Out of the box scaffolding
• Rich form library, with both simple and complex widgets
• Form fields easily integrate with your models, save
relationships
• $form->saveInto($record);
$record->write();
Form Library
• Simple Fields – TextField, DropdownField, DateField
• Structure Fields – HeaderField, LiteralField
• Relationship Fields – ComplexTableField,
CheckboxSetField
• Much much much more!
• Many fields in modules, and its easy to create your own!
Forms in the CMS
• Simple to add fields in the CMS
• Just overload getCMSFields on your DataObject, and call:
$fields->addFieldToTab(‘Root.Tab’, $field)
• Can also hook in using extensions to modify the fields on
existing objects without subclassing
ModelAdmin
• Fully scaffolded CRUD interface, with easy searching.
• Easily customisable, anything can be changed.
• Can be extended to very complex use cases.
Templating
• Simple templating language, cached as raw PHP
• Not XML based, used for emails, HTML, all kinds of things
• Doesn’t limit the markup you can create
• Theming system for bundling templates
• Layout and include support across modules
Requirements
• System to include, and block CSS and JS assets from
templates and PHP code
• Supports minifying and combining
• Requirements::css(‘mysite/css/my.css’)
Requirements::themedCSS(‘mycss’)
<% require javascript (mysite/css/my.css) %>
Controllers
• Simple URL routing:
Director::addRules($priority, $rules)
• RequestHandler is a simple barebones controller, just
takes a response and returns a response
• Controller has more utility methods, support for actions
etc.
Controllers Continued
• Once the initial URL routing is done, the request is still not
always done.
• A controller can return a controller as its result, which then
moves down the URL and uses that controller to parse the
request
• This means you can easily create complex controllers
from several controllers
• For example, the CMS controller returns a Form object,
which then leads to a form field, which then renders a pop
up
• Cascading permissions!
Page Controllers
• Each page type also has a corresponding controller,
which handles the actual request
• Can easily define custom actions, methods as you would
expect
• Can also define controllers without a matching page to
simulate a page without actually having one
THAT’S A QUICK OVERVIEW
OF SOME OF THE CORE
Now for some cool random features!
Caching Support
• Supports full page caching, with optional header
management
• Can rsync to remote hosts
• Automatically updates cache on publish
• Partial caching, with automatic invalidation
• Integration with Zend_Cache
2008 DNC
2008 DNC
• One private CMS server, rsynced static content out to
several other servers
• 100M+ page view
• 350 000 hours of HD video, some live
• Bi-lingual
• Could still make changes to site during heavy load times
Easy API’s
• Simple SOAP and RESTful API’s out of the box
• Easily convert data to and from XML, JSON, form
encoding
• Utility classes for consuming APIs
• Easily expose updates via RSS
Translation and Internationalisation
• Support for simple string translation with PHP language
files (in templates as well)
• Javascript translation support
• DataObjects can have an extension applied to add
translatable support
• Full translation support in the CMS
Reports
• Two types of reports – simple lists of pages in the CMS
and more complex reports in their own tab
• You can easily define your own reports by extending
SS_Report
• Just implement a few methods and you’re done!
SearchContext
• Allows you to define an “advanced search” interface for
your DataObjects
• Scaffolded by default, and used in ModelAdmin
• Works in both ModelAdmin and the frontend easily
• Define advanced search forms with simple code by using
“search filters”
And much more
• Configurable error handling, emailing and logging.
• Easily create scheduled and build tasks
• Insert dynamic content into html text fields using
shortcodes
• Define widgets with a simple drag and drop interface
• Sake for running silverstripe commands from the CLI
• Easy environment-specific configuration
• Page comments
Cool Modules!
• User Forms
• Queued Jobs
• Forum
• Blog
• Workflow
• Sphinx, Solr, Zend_Lucene
• Spam protection – recaptcha, mollom..
• And many more!
User Forms Module
DB Plumber
Pixlr Image Editor
What’s Next?
• SilverStripe 3 is currently being talked about
• New ORM?
• New template parser?
• Revamped media and download handling?
• Better module and configuration management?
• More cowbell?
Any Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfAlfresco Software
 
Showcasing drupal
Showcasing drupalShowcasing drupal
Showcasing drupalOpevel
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 PresentationEric Landmann
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideMark Rackley
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website Phase2
 
Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointRene Modery
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Lucidworks
 
Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLRichard Schneeman
 
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Sonja Madsen
 
Oracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنOracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنayman hamdan
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Derek Gusoff
 
Web programming and services
Web programming and servicesWeb programming and services
Web programming and serviceslaibamaqsood
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)Alexander Goida
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksGaurav Singh
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Reviewnetc2012
 
Spca2014 js link and display templates hatch
Spca2014 js link and display templates hatchSpca2014 js link and display templates hatch
Spca2014 js link and display templates hatchNCCOMMS
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchyJason Yingling
 

Was ist angesagt? (19)

PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
Showcasing drupal
Showcasing drupalShowcasing drupal
Showcasing drupal
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website
 
Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePoint
 
Drop acid
Drop acidDrop acid
Drop acid
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQL
 
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
 
Oracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنOracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردن
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2
 
Web programming and services
Web programming and servicesWeb programming and services
Web programming and services
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)
 
Revision
RevisionRevision
Revision
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
 
Spca2014 js link and display templates hatch
Spca2014 js link and display templates hatchSpca2014 js link and display templates hatch
Spca2014 js link and display templates hatch
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchy
 

Ähnlich wie SilverStripe From a Developer's Perspective

Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Share point development 101
Share point development 101Share point development 101
Share point development 101Becky Bertram
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPressTaylor Lovett
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDavid Mann
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015Hossein Zahed
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your WebsiteAcquia
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoFu Cheng
 
Sqlite
SqliteSqlite
SqliteKumar
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Codeindiver
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!Ben Steinhauser
 

Ähnlich wie SilverStripe From a Developer's Perspective (20)

Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
 
Share point development 101
Share point development 101Share point development 101
Share point development 101
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 
Database
DatabaseDatabase
Database
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Lecture 9: Dynamic web application
Lecture 9: Dynamic web applicationLecture 9: Dynamic web application
Lecture 9: Dynamic web application
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Sqlite
SqliteSqlite
Sqlite
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
WebDev Crash Course
WebDev Crash CourseWebDev Crash Course
WebDev Crash Course
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Code
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
 
72d5drupal
72d5drupal72d5drupal
72d5drupal
 

Kürzlich hochgeladen

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

SilverStripe From a Developer's Perspective

  • 1. SILVERSTRIPE & SAPPHIRE From a Developer’s Perspective
  • 2. About • SilverStripe CMS is built on top of the Sapphire framework • Sapphire is a modular PHP 5, OOP, MVC framework with lots of cool features • Supports Apache and IIS equally well • Can run on MySQL, SQLite, Postgres, MSSQL…
  • 3. Structure • Everything is a module • Sapphire is the core module, with all (except for direct file retrieval) requests routed through it • The CMS is an module just like any other • All code and theme assets (templates, css etc) are listed in an automatically generated manifest - easy for the system to find
  • 4. Modules • Module is simply a folder with a _config.php file • Installation as simple as putting a folder in the root directory and building the DB • Defined points to hook into the base CMS functionality using extensions • Everything is a module, including your project code
  • 5.
  • 6. MVC Let’s look at each of those letters
  • 7. MVC Definition • Model – contains the behaviour and data of your application. DataObjects and ORM. • View – HTML, and other presentational elements. .ss templates. • Controller – responds to requests and binds the model to the view. *_Controller classes.
  • 8. Data • You define your models as subclasses of DataObject • Define your fields, relationships, and metadata on the class, automatically built • Uses multiple table inheritance
  • 9. Defining Your Schema • You define your database fields in a $db array • Automatically pulls casting information from this • Define relationships in their own array • Visit or run /dev/build to rebuild the database • Done!
  • 10.
  • 11. Easy Relationship Management • Several relationship types – has_one, belongs_to, has_many, many_many, belongs_many_many • Easy accessing: • $this->Relationship($filter); • $this->Relationship()->addMany($items) • $this->Relationship()->map()
  • 12. Page Types • Complex DataObject, forms the core of most websites • Managed via the main admin panel in the CMS • Easy to customise, can contain any type of data • Make SilverStripe ideal for your data, not the other way around • Each page type is coupled to its own controller
  • 13.
  • 14.
  • 15. Retrieving Data • Simple accessors – DataObject::get() and DataObject::get_one() • Can use SQLQuery and DB::query() to peek behind the ORM • Automatically caches certain things, performs default sorts and allows hooking into the process
  • 16. Changing Data • $object->Field = $value • $object->write() • $object->publish(‘Stage’, ‘Live’) • $object->delete()
  • 17. Extensions (AKA Decorators) • Add functionality to classes at runtime, without subclassing • Can add new methods, database fields, change and enhance behaviour • Many core processes have hooks that extensions can hook in to • Object::add_extension($subject, $extension)
  • 18. Extensions Continued • Add new database fields and form fields in the CMS • Lock a user out if a third-party criteria is not met • Change the permissions model to either force permissions allowed or denied • Add image editor support to the CMS image insertion form • Restrict content to a specific subsite • Add extra fields to the member profile • Add static caching to the publishing process
  • 19. Core Extensions • Versioned – adds support for staging/publishing, as well as rolling back to specific versions • Hierarchy – Allows for a tree of objects to be stored in the DB, with related utiltity methods • Translatable – Adds support for saving multiple languages in one table, switch between languages, edit in CMS
  • 20. Much more than just data • Extensions can hook into all parts of SilverStripe • Basically anywhere a developer calls • $this->extend(‘methodName’) you can hook extra behaviour in
  • 21. Easy Forms • Out of the box scaffolding • Rich form library, with both simple and complex widgets • Form fields easily integrate with your models, save relationships • $form->saveInto($record); $record->write();
  • 22. Form Library • Simple Fields – TextField, DropdownField, DateField • Structure Fields – HeaderField, LiteralField • Relationship Fields – ComplexTableField, CheckboxSetField • Much much much more! • Many fields in modules, and its easy to create your own!
  • 23. Forms in the CMS • Simple to add fields in the CMS • Just overload getCMSFields on your DataObject, and call: $fields->addFieldToTab(‘Root.Tab’, $field) • Can also hook in using extensions to modify the fields on existing objects without subclassing
  • 24. ModelAdmin • Fully scaffolded CRUD interface, with easy searching. • Easily customisable, anything can be changed. • Can be extended to very complex use cases.
  • 25.
  • 26.
  • 27. Templating • Simple templating language, cached as raw PHP • Not XML based, used for emails, HTML, all kinds of things • Doesn’t limit the markup you can create • Theming system for bundling templates • Layout and include support across modules
  • 28.
  • 29. Requirements • System to include, and block CSS and JS assets from templates and PHP code • Supports minifying and combining • Requirements::css(‘mysite/css/my.css’) Requirements::themedCSS(‘mycss’) <% require javascript (mysite/css/my.css) %>
  • 30. Controllers • Simple URL routing: Director::addRules($priority, $rules) • RequestHandler is a simple barebones controller, just takes a response and returns a response • Controller has more utility methods, support for actions etc.
  • 31. Controllers Continued • Once the initial URL routing is done, the request is still not always done. • A controller can return a controller as its result, which then moves down the URL and uses that controller to parse the request • This means you can easily create complex controllers from several controllers • For example, the CMS controller returns a Form object, which then leads to a form field, which then renders a pop up • Cascading permissions!
  • 32. Page Controllers • Each page type also has a corresponding controller, which handles the actual request • Can easily define custom actions, methods as you would expect • Can also define controllers without a matching page to simulate a page without actually having one
  • 33.
  • 34. THAT’S A QUICK OVERVIEW OF SOME OF THE CORE Now for some cool random features!
  • 35. Caching Support • Supports full page caching, with optional header management • Can rsync to remote hosts • Automatically updates cache on publish • Partial caching, with automatic invalidation • Integration with Zend_Cache
  • 37. 2008 DNC • One private CMS server, rsynced static content out to several other servers • 100M+ page view • 350 000 hours of HD video, some live • Bi-lingual • Could still make changes to site during heavy load times
  • 38. Easy API’s • Simple SOAP and RESTful API’s out of the box • Easily convert data to and from XML, JSON, form encoding • Utility classes for consuming APIs • Easily expose updates via RSS
  • 39. Translation and Internationalisation • Support for simple string translation with PHP language files (in templates as well) • Javascript translation support • DataObjects can have an extension applied to add translatable support • Full translation support in the CMS
  • 40. Reports • Two types of reports – simple lists of pages in the CMS and more complex reports in their own tab • You can easily define your own reports by extending SS_Report • Just implement a few methods and you’re done!
  • 41.
  • 42. SearchContext • Allows you to define an “advanced search” interface for your DataObjects • Scaffolded by default, and used in ModelAdmin • Works in both ModelAdmin and the frontend easily • Define advanced search forms with simple code by using “search filters”
  • 43.
  • 44.
  • 45. And much more • Configurable error handling, emailing and logging. • Easily create scheduled and build tasks • Insert dynamic content into html text fields using shortcodes • Define widgets with a simple drag and drop interface • Sake for running silverstripe commands from the CLI • Easy environment-specific configuration • Page comments
  • 46. Cool Modules! • User Forms • Queued Jobs • Forum • Blog • Workflow • Sphinx, Solr, Zend_Lucene • Spam protection – recaptcha, mollom.. • And many more!
  • 50. What’s Next? • SilverStripe 3 is currently being talked about • New ORM? • New template parser? • Revamped media and download handling? • Better module and configuration management? • More cowbell?