- What is MODx?
- What is MVC?
- What is xPDO?
- What is an ORM?
- A Brief Overview of Revolution
- The Model
- The View
- In the front-end, they are Templates, Chunks and Resources.
- In the Manager
- The Controller
- The 2nd C: The Connectors
- See Also
MODx Revolution is an Content Application Platform, built for developers, designers and users who want a powerful, scalable system with flexible content management built in.
MVC is "Model-View-Controller", a common programming paradigm where the data's Model is only accessed through a Controller, which connects to a View that can easily be changed without having to change the Model.
MVC² is a MODx terminology that is "Model-View-Controller/Connector". It basically adds a new way of accessing the model from the view - Connectors, which are AJAX-based files that "connect" to processors to provide remote CRUD interactions.
Connectors are simply gateway files that hook into specific Processors. They are used mainly to prevent direct accessing of processors, and limit user access to those processors.
xPDO is our name for open eXtensions to PDO. It's a light-weight ORB (object-relational bridge) library that works on PHP 4 and 5, and takes advantage of the newly adopted standard for database persistence in PHP 5.1+, PDO. It implements the very simple, but effective Active Record pattern for data access, as well as a flexible domain model that allows you to isolate domain logic from database-specific logic, or not, depending on your needs.
As defined by Wikipedia:
An object-relational database (ORD), or object-relational database management system (ORDBMS), is a database management system (DBMS) similar to a relational database, but with an object-oriented database model: objects, classes and inheritance are directly supported in database schemas and in the query language. In addition, it supports extension of the data model with custom data-types and methods.
Basically, tables in SQL databases become classes that can contain table-specific methods, inherit from base classes, and much more.
Revolution at its core is a Content Management Framework. It's not a PHP Application Framework like CodeIgnitor or Symfony, nor does it purport to be one. With that said, it's much more than a typical CMS like Wordpress or others; it enables you to build Content Management Applications with ease and extensibility.
Revolution bases its internal structure on what we call a MVC² design system. It's loosely based on the MVC, or model-view-controller architectural pattern, in programming.
The M stands for Model, which is the core classes that manipulate data records. These core classes, prefixed with 'mod' in Revolution, handle all the Domain logic for MODx Revolution.
This also includes what Revolution calls "processors", which are scripts that handle Domain Logic for MODx Revolution. They are never accessed directly, and are used to handle form processing, REST requests, AJAX requests, and more. They resemble basic CRUD (Create-Read-Update-Delete) processing tasks.
Views in MODx Revolution are called 'Templates', but are used differently based on what context we're talking about.
Templates are what they sound like. They allow you to create templates that will encapsulate more page-specific data. Think of them like headers/footers all rolled into one (and so much more!)
Chunks are small pieces of HTML code that can be inserted anywhere. They represent View widgets, in a sense, because of their modularity and ease of insertion.
Resources is the basic representation of a single "webpage" in MODx Revolution. They represent a single page or resource by which the client accesses content from the server. They can be files, weblinks, symlinks or just plain-old HTML pages wrapped by Templates.
In the manager-side of MODx Revolution, the View is handled by templates as well, although these are file-based and located in manager/templates, and currently loaded via Smarty.
Controllers in MODx Revolution come in two forms. In the front-end, they are Request Handlers (via the modRequest class) and Snippets and Plugins.
Snippets are simply PHP code that can be placed anywhere in a page. They can be placed in Chunks, Templates, or Resources. They simply execute PHP code whenever they are called, and return whatever output they would like to push to the page.
Plugins are also PHP code, but are targeted at specific System Events that occur throughout the request processing. They can occur before the webpage is rendered, after it is, before the request is handled, or many more places.
They allow users to write generic code that affects basic page functionality, such as word censoring, automatic link creation, separate cache handling, context redirection, and more.
Connectors are a new idea to MODx Revolution; they are access points for processors. The manager system in MODx Revolution uses them extensively; they provide secure locations for AJAX requests to process data on certain objects.
For example, a connector request that loads /modx/connectors/resource/index.php with a GET 'action' parameter of "get", and a GET parameter of 'id', will (assuming the request's client has access) grab the Resource with the ID specified and return it in JSON (or whatever is configured; this is JSON by default in Revolution) format.
Every Connector request is also secured down by Context permissions loaded on every request. If the user does not have access (via the Access Policy assigned to the request's context), the connector will refuse to provide data.
Connectors allow for dynamic, secure JSON requests (and eventually REST-based requests) straight from your MODx manager.