SilverStripe
eBook - ePub

SilverStripe

The Complete Guide to CMS Development

Ingo Schommer, Steven Broschart, Julian Seidenberg

Condividi libro
  1. English
  2. ePUB (disponibile sull'app)
  3. Disponibile su iOS e Android
eBook - ePub

SilverStripe

The Complete Guide to CMS Development

Ingo Schommer, Steven Broschart, Julian Seidenberg

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

This is the Official Guide on the award-winning SilverStripe programming framework, authored by the creators of the open source CMS.

SilverStripe is a robust and flexible website content management system (CMS) tightly integrated with an application framework. It is open source and embraces modern system architecture and agile development methodologies. Intermediate developers can implement powerful websites and web-applications quickly and customize them to their individual needs. The award-winning PHP5/MySQL-based system saves not only time and nerves for techies, but also features a straightforward interface which is a joy to use for non-technical content-authors.

This Guide helps you to:

  • Get started with SilverStripe: Learn the architecture and usability principles that underpin SilverStripe's modern approach. Then go through the technical requirements, the installation process, and useful tools for your daily work.
  • Learn the CMS: Practical examples show you how to use the CMS as a content author, and how to manage content, images, documents, and forms without technical knowledge. Administrators learn how to set up permissions and security groups.
  • Develop a custom application: Use MVC and other modern design patterns to create well-structured, object-oriented PHP code and concise template markup. Let the authors walk you through creating an interactive recruitment website as practical example project.
  • Extend through clean code and modules: Understand how SilverStripe is built on modularity and how this empowers you to build plugins and core extensions in an elegant, maintainable fashion.
  • Use SilverStripe professionally: In-depth topics on internationalization, security, unit testing, caching, multi-page forms, and web services APIs ensure that you can build world-class websites.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
SilverStripe è disponibile online in formato PDF/ePub?
Sì, puoi accedere a SilverStripe di Ingo Schommer, Steven Broschart, Julian Seidenberg in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Conception e Conception Web. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Editore
Wiley
Anno
2010
ISBN
9780470711477
Edizione
1
Argomento
Conception
1
Introduction
At it’s heart, the role of a content management system (CMS) is to make it easier to publish content to websites and intranets. It may be used to allow the owner of a one-person company to update his or her website without needing a website developer or learning HTML skills. Or, in a multinational company, it might allow a skilled web team across various cities to manage a complex assortment of updates to products, services, promotions, and news in multiple languages. Either way, it automates various tasks, and makes building a website more efficient and reliable.
Countless products are available based on such a promise, however, all of varying sophistication, histories, programming languages, and geographical dominance. The decision-makers and developers involved in selecting a CMS work in fast-paced environments and are creatures of habit: They have personal favorites to solve the challenges their job provides. Why go through the trouble of trying a new CMS?

1.1 Why SilverStripe?

One thing up front: SilverStripe is not the answer to all problems that you might face throughout the development of a website or web application. No software is ever a silver bullet for every situation. You must determine selection criteria based on your needs, skills, budgets, and timeframes, and select the most relevant tool based on those criteria. That said, SilverStripe is intended to be both used out-of-the-box and for major customization. This makes it particularly interesting when building websites - because everyone seems to relish having a unique set of needs in terms of design, information architecture, content, features, integration with other systems, business policies, and so on.
The following pages list some major benefits of SilverStripe, and describe how it stands out in a crowded CMS market. We acknowledge that the information here is concise, but this will help you refer back to an overview even when you’re familiar with SilverStripe. We try to keep things brief here; the rest of the book will substantiate the claims made, as you begin to build stuff using the software.

1.1.1 An Application and a Framework

SilverStripe is really two products in one: The SilverStripe CMS and the Sapphire Framework. There are plenty of CMS applications and quite a few programming frameworks in the marketplace; however, SilverStripe is very rare in that it tightly weaves the two concepts together.
You will need to read the whole book to understand entirely the value of this unity, but the value is much greater than the sum of its parts. In other words, the CMS has plenty of good things about it, as does Sapphire. However, with them joined so closely, their collective value is multiplied. The closeness of the two concepts is possible because Sapphire and the CMS were created in tandem, by the same people.

1.1.2 CMS for Content Authors and Framework for Developers

One fundamental reason for SilverStripe being divided into two sections is to honor the needs of two quite separate types of people who use the software. The CMS backend is designed to allow non-technical users to update web pages, images, links, moderate blog comments, and so on. This is the area where content authors do their content management, and anything technical is strictly kept out of sight for the sake of good usability.
The framework is used to build the underlying website, and isn’t for content authors. You ‘use’ the framework by actually writing HTML, CSS, JavaScript, and object-oriented PHP code. The framework enables beginning PHP programmers to achieve quite powerful things, by following recipes and tutorials as shown in this book and elsewhere. However, the framework is targeted at savvy PHP programmers. For them, Sapphire allows much more creative freedom in building complex websites quickly and robustly.
Many other CMS products don’t have such a separation. In other words, in many systems the CMS user interface is shared by content authors and developers, which typically makes the interface too complicated for it’s primary users: the content authors. In some systems, developers perform their work mainly through a graphical configuration interface, which is usually more limiting than raw programming. A graphical interface to accommodate sophisticated needs for developers would require a bewildering set of options, which would add complexity and bloat the software, when the idea in question is likely to be far more efficiently expressed as a few lines of code.
So, this separation in SilverStripe means that the CMS backend can be designed for non-technical users, and the framework can confidently concentrate on being suitable to technically-minded web developers (see Figure 1.1 for an overview of the SilverStripe system).
Figure 1.1 SilverStripe system overview.
002

1.1.3 Clear Separation of Concerns

As we begin to suggest above, a core principle in SilverStripe is the separation of concerns. In this introduction, we use that term loosely to mean organizing the software into all sorts of logical divisions. You will be familiar with how HTML and CSS separate the concerns of markup and presentation, and that JavaScript is used to allow for the concern of behavior and interaction on a web page. This structure provides many benefits such as enabling reuse: change a single style in a CSS file, and so long as you’ve stuck to best practices in your HTML, styles throughout the whole website will update, saving time and maintaining consistency.
SilverStripe follows this principle: Update an isolated area of the system that deals with a particular function, and it produces logical, robust, and application-wide changes. Without this architectural principle, changing a feature of your website means changing a few lines of code here, a few lines of code there, and finding that each step of the way upsets unrelated parts of your website. This domino effect suddenly turns a small change into a major coding and testing fiasco. SilverStripe’s architecture therefore helps to keep code changes proportionate to the effort needed to implement them. However, like the HTML, CSS, and JavaScript example, this reward is only given to those who carefully architect their SilverStripe application to its best practices.
Let’s highlight a few examples relating to this principle:
Avoid repitition with the Sapphire framework. Sapphire supports the concept of writing the logic of your website once. For instance, if your website deals with selling T-shirts, you define that a T-shirt has an attribute ‘color’ in one place in your code. You don’t have to write redundant code elsewhere to explain that T-shirts have colors; the template, CMS, and even the database will automatically be updated based on your single declaration. This principle is commonly called Don’t repeat yourself (DRY ).
No need to change database schema manually. This important point is hinted at above: SilverStripe will inspect your code for the tables and fields it needs, and update the schema accordingly. This makes keeping your database schema in sync with your PHP code a beautiful thing.
Separates the PHP logic into the Model and the Controller. You’re probably familiar with separating PHP logic from HTML templates, but SilverStripe goes one step further. This is a very integral part of Sapphire, so let’s pause for a moment to investigate this in the following box.
Model View Controller as a central concept
The Model View Controller (MVC) concept is one of many design patterns that have been identified as good programming architecture. A design pattern is essentially a structured way to document the solution to a specific problem in computer science, a term made popular by the ‘Gang of Four’ in their book Design Patterns: Elements of Reusable Object-Oriented Software (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, published by Addison-Wesley). The three parts, Model, View, and Controller, describe the main roles of any application built with SilverStripe:
• The Model is responsible for maintaining the state in the application. It’s basically data: Some of it might be transient and only live within a web request, whereas other data might be permanently stored in a database. You can think of the Model as essentially the database schema you have for a website. We elaborate on this simplistic definition in later chapters.
• A View displays data that’s collected from the Model, usually through a template on a website or application frontend. One Model might have many Views: The list of forum users on your website might have a ‘public view’ and a ‘backend management interface view’. In both of these views, the used Model logic would be the same: The separation into different roles avoids code duplication and clarifies responsibilities.
• The Controller manages the layer in between the Model and View, and passes data between them. It’s the ‘glue’ of an application. It might take a new forum submission from a View, and tell the model to store it in the database. Although the actual input form is rendered in the View, the Controller is responsible for processing it. The Controller, for instance, would ensure that the submitter can post to this forum, and might send out emails to moderators or people subscribed to the forum. To clarify, the Model should not be responsible for such logic, and instead just store the data once the Controller has figured out what needs storing and how. Using the example here, separating the Model and Controller shows how you can have different form processing logic (multiple Controllers) making reuse of the Model.
All three roles work closely together. It’s just important to understand what goes where on a conceptual and practical level. If that sounds a bit too abstract for you at the moment, don’t despair. MVC is a central concept in SilverStripe, and we’ve dedicated an in-depth explanation to it in Chapter 3, Section 3.2, ‘MVC - Model View Controller’.
Object Relational Mapper. The PHP code throughout SilverStripe is heavily object-oriented rather than procedural code, and this architecture extends to how you access the database. This maintains a unified approach to processing data both in and out of your database: you deal with objects rather than flipping constantly between arrays, methods, objects, SQL syntax, and so on. This lessens the lines of code used to create, remove, update, and delete data in your database, and improves readability. It also marries the database schema more closely to your PHP code, thereby lessening the risk that these are out of sync. The concept is explained in Chapter 3, Section 3.3, ‘ORM - Object Relational Mapping’ in more depth.
A very flexible data-model. Because of the ORM and the MVC patterns, SilverStripe is able to consume quite complex data structures. You might have all sorts of different ‘types’ of pages, each with different fields. Then you might add products, members, product reviews, coupon codes, and all sorts of other objects to your website. All of this data needs to be stored in your database, managed in the CMS, and presented on your public website. SilverStripe allows you to have a complex entity model, full of relationships, while ensuring the structure and data granularity is elegant.
HTML, CSS, and JavaScript. Being the lingua franca of the web, SilverStripe respects that competent website developers need to have control over and separate their website into these three languages. In other words: SilverStripe doesn’t make you add CSS into your HTML. Nor does it prevent you from intelligently using JavaScript to progressively enhance your website with extra functionality. It stays out of your hair - as a developer, you can craft these files and incorporate them into your project in an elegant fashion. This provides for fantastic flexibility in your markup, therefore providing freedom in visual design.
Simple template language. The ‘View’ mentioned in the MVC explanation above means that SilverStripe templates don’t contain logic. More than simply insisting pedantically that the Controller instead should contain this logic - it means that the templates deliberately resemble standard HTML syntax and that they can be created and edited by people without PHP skills. This lets you unleash your zealous HTML- and CSS-skilled designer on SilverStripe templates. Compared to other templating languages, SilverStripe’s seems overly simplistic. But you might come to appreciate the benefit of this in the same way you appreciate extracting your CSS out of your HTML: When you need to change something you have only one place to look, making changes easy and encouraging consistency.
Class inheritance as a means of customization. This is really a topic for a later chapter in the book. But it’s important, and so we whet your appetite with a preview. If you have the concept of a ‘Product’ in your application, how do you customize that to make some ‘Products’ a ‘Book’, which might require an Author field? Extensions like this are fundamental to any CMS software package. SilverStripe uses the natural capabilities of an object-oriented language to extend Products into Books. This is nothing special in any object-oriented language, and all MVC frameworks do this, but it’s rare for a CMS to get out of your way and just let you use these natural features of object-oriented code.
Clean file system structure. SilverStripe’s file and folder structure is neatly organized in several ways. The core application lives in a couple of top-level folders. All your project-specific changes go into your own top-level folders, providing convenient separation from the core package. Files containing code are named specifically based on the PHP classes they define. This means a lot of files, but also makes the role of each file specific and deliberate. Template files follow similar naming conventions, which makes SilverStripe websites portable: You can just move files and folders from one installation to another and be confident about what functionality in the application you’re shifting.
Modules, themes, and widgets. The core functionality of SilverStripe can be extended by modules (for example ‘forum’ functionality), themes (changing the visual appearance of your website), and widgets (small features you can add to a page). We will build all of these types throughout this book. Extensions allow the core to be...

Indice dei contenuti