MODx is a content management system and an application framework. MODx makes it quick and simple to create websites that are interactive and that can expose different functionalities, depending on the kind of user visiting the site. The creation of all of this is made possible without the user having any coding background as many of its powerful features work out-of-the-box, without any code changes. MODx and its shipped components are modular and well-abstracted so that the same components provide multiple behaviors, which are determined by how the components are used.
Set content management rules
Managing content means allowing a user to create, publish, edit, and organize content. A good CMS assumes that the user has no technical knowledge. Hence, it provides an easy-to-comprehend user interface for managing content. A ﬂexible CMS will maintain ease of use, even for a novice, and yet give much ﬂexibility to the professional. Publishing the content must extend beyond just displaying the content, and should include designing how the content is shown, making the content accessible, and allowing easy search of the content, based on various criteria.
Content management rules allow the management of content to be delegated and distributed from just one user to many. Different access levels can be granted to different groups, and users can belong to one or more of the deﬁned groups.
Managing content is ﬁne, but what exactly is content? A good CMS allows the end user to deﬁne what content is. Content can be anything! It can be raw text, pictures, videos, music, or a combination of a few, or all, of them. A necessity in any CMS is to allow the user to deﬁne the possible types of content and give such types a name.
An application framework is an integrated platform that makes the process of developing and maintaining applications a lot simpler. Often they support a certain development methodology and provide interfaces and tools to make the development rapid and agile.
An application framework serves the following two primary purposes:
Reusable program components: Any code that has been written once should be available for use within the same application, and in other applications too. This is called reusability. Generally, high reusability is achieved by careful planning and adherence to an objected-oriented paradigm. An application framework reduces the overheads in developing such reusable program components, and handles many of the coding overheads internally.
The development of websites has evolved over the years. They initially originated from simple hyperlinked pages that provided a wealth of information, evolving to complex objects being exposed as URLs at runtime. When wanting to develop a site, there are multiple options that one may choose for development. A briefing on the most widely known methodologies follows.
The 'old school' approach is to use a programming language to create a complete site or application from scratch without using any third-party templating system or framework. In this method, there are three layers:
One advantage of the conventional three-tier architecture is that it has fewer dependencies. Generally, the only real dependency for such sites is the language itself and the database, if used. Hence, they can be run in any environment that supports the language and, if necessary, the database server. This advantage looks minimal considering the other overheads and the increasing support for CMSs and frameworks among the hosting providers.
The only restriction on what you can do is the limitation of the language itself. Coding everything from scratch, along with the overheads, also brings the ﬂexibility of doing anything exactly the way you want. The only limitation on what can be done and what cannot be done is what is imposed by the language itself. Again, this is not a real advantage as the emerging technologies are being built so abstract that they impose almost no restriction themselves.
The conventional three-tier architecture can be used to develop new development methodologies. Whatever the framework of the CMS may be, beneath the surface, they must all follow the same core rules. Hence, something about these systems takes care of handling requests and generating responses at the lowest layer, which the developer need not worry about. The components that take care of such activities are themselves coded in the conventional three-tier architecture.
Having to reinvent the wheel is a big disadvantage of the conventional three-tier architecture. Any big project will have a common set of functionalities that are repeated. Many projects have, in fact, emulated an existing CMS or framework in the process of building their own tools. This is just repetition of work and time that could have been spent more productively. Most projects written in the conventional three-tier method end up reinventing the wheel, at least for the concepts of "formatting output" and "database abstraction".
Another disadvantage is that the three-tier architecture is error prone. The language allows you to get things done. It doesn't check if they are done cleanly or not. Hence, it is very simple to write code that gets something done, but not so easy to write clean code that gets the same thing done, even in the worst conditions.
The three-tier architecture is also difficult to maintain. It could be said that code is more read than written. And with this approach, because HTML is mixed with server-side code and appears messy, it is hard to read and maintain such code. Also, if the custom-written libraries are not well documented by the developers who wrote them, then the maintenance becomes even harder as one must read the code to understand its functionalities.
URL mapping becomes complex with the three-tier architecture. It must be noted that in most cases, the job of a server-side script is just to generate client-side output that can be rendered in the browser. So, when such an HTML page with further possible actions is created, the server-side script must be able to generate navigational elements and carefully map the links to a server-side script that can handle the particular request. That is, it has to map a URL to server executable code. This can become tedious to maintain as the site grows, or when a new team is introduced to maintain the code.
Security becomes problematic with the three-tier architecture. The language may have security vulnerabilities, such as SQL injection. Alternatively, there may be security bugs introduced by the programmer. Because, in this approach, all of the functionalities are taken care of by the programmer, there must be strong security testing for all developed functionality and different combinations of use-case scenarios. It is also possible that certain situations can go unforeseen. Writing secure code in such an architecture requires strict discipline, and is laborious.
Templating is the idea of using ﬁles that are very similar to regular HTML ﬁles, to render output. These template ﬁles have what is known as variable replacement, or commands, similar to a programming language, called directives, that can be inserted within HTML. Hence this approach clearly separates what is called presentation from logic. Apart from this single concept, everything else is the same as the approach mentioned above. Templating also inherits all of the advantages and disadvantages mentioned previously. The ones in addition to those already mentioned are listed below.
One of the main disadvantages of templating is that there is a small learning curve for a new templating language. Every new templating language introduces a new syntax and, hence, a small learning curve. The time it takes to learn a templating language depends on the complexity of the system. However, a programmer can generally start using a templating language with just the reference guide or cheat sheets.
Application frameworks are systems built on top of a programming language to let the developer focus only on the logic of the application. The framework takes care of the other repetitive work. All frameworks at least have the well-known features of "URL Mapping", "DB Abstraction", and "Templating". How each of these is implemented internally is specific to the framework. Every framework also exposes a methodology, the most famous of which is called MVC, which stands for Model, View, and Controller. The framework itself will contain documentations and libraries for frequently used functionalities, thus making the developer's work easier. Every framework also tries to ensure cross-browser compatibility, cross-platform support, and many other clean practices, most importantly the RESTful approach.
For more information on RESTful practices, read www.xfront.com/REST-Web-Services.html.
One of the main advantages of application frameworks is that there is a high reusability of code. Frameworks encourage architectures where a higher reusability of code is possible. They also provide enough APIs to do the most common tasks, so that developers don't have to rewrite them.
Application frameworks provide clean practices at no extra effort. Most frameworks follow clean practices, and because they allow you to take care only of the logic, the internals are handled by the framework. Hence, while you may not even know it, you have generated applications that adhere to clean practices!
Application frameworks have good testing mechanisms. Generally, application frameworks also provide some kind of helpful mechanisms to make testing easier. Most MVC frameworks auto-generate test files, or at least generate a very useful skeleton for each unit of functionality being implemented.
In application frameworks, view is separated from logic, which is similar to using a templating language. Most frameworks allow a mechanism for separating view from logic. Some frameworks do this by using a templating language that the framework understands. But this is only one way of doing it, and many frameworks follow different approaches to achieve the same outcome.
Database abstraction means writing a system in such a way that if you were to only change the database server that stores your data, your system would still work without any necessary code changes. Also, most frameworks have an implementation of the concept of Object-Relational Mapping (ORM), which allows the developer to manipulate the database as objects and provide a simple syntax to achieve complex queries.
When working with application frameworks, there is a big learning curve in understanding the development methodology that the framework understands and expects you to follow. Getting used to a new development methodology can take some time.
All application frameworks have framework-specific syntaxes for a lot of functionalities that they expose. It takes some time to be able to get to the exact documentation when you need it.
Most MVC frameworks have a single templating system, or DB abstraction layer, already deﬁned that you have to use. For some applications, this might be a limitation, or maybe you just prefer something else. This is a small disadvantage. Certain frameworks, like "Catalyst", allow developers to choose individual components as well.
Content management systems are a very interesting idea. The focus of any content management system is that the end user must be able to create websites that can be self-maintained without any programming knowledge. A CMS makes it simple to create the kind of sites that are generally known as Web 2.0. Web 2.0 simply means sites in which the content is being displayed is created by the end users and not the developers of the site. There are numerous content management systems, and each has its own exposed architecture. To use a content management system, one must understand the basics of the particular system, and then comprehension and insight into how one performs development using that particular system. Hence, one can quickly start creating powerful and dynamic websites.
When using a content management system, often the only thing that is required to build the site is to let the system know what type of content you want, how you would like it to be displayed, and who can do what. Almost everything else is handled by the system. This allows the developer to focus on the key areas of any website, which are the content itself and its presentation.
Most content management systems come without the prerequisite of needing to know a programming language. Although knowledge of the language helps in many ways, one can still build powerful and custom sites without any prior experience. Moreover, all CMSs are so user-friendly with onscreen help and wizards, that you have all that you need to get started right in front of you. Perhaps, simplicity is the keyword for any CMS. Of course, the simplicity mentioned here is what is called pseudo-simplicity, where a complex system hides within itself all of the complexity but exposes a simple usability.
Content management systems come with the necessary demonstration templates and sample pages that can be used to quickly kickstart the website. In most CMSs, almost without any effort, you have the baseline to start with, and all that is left to do is customizing the site to your requirements.
Simple sites are alright, but when the requirement grows, creating everything with what is already available requires a new mindset. Often, the biggest hurdle that developers find in getting used to a content management system is that everything is deﬁned as content and not objects or functions. So every component that is available for download speaks in terms of what it does with the content. It is often necessary to use multiple components to get what you need. This is the case with any well-abstracted system; it takes a new mindset to learn it!
Many CMSs introduce the requirement of some templating language to be able to customize the look and feel of the site. In such cases, there is an overhead of learning the templating language, as well as learning how to use the templating language to create a new look and feel within the CMS used.
A big disadvantage of a CMS is that you are restricted to the functionalities provided by the CMS. Depending on the exposed architecture, there could be practical limitations on the extendibility of the CMS. Certain CMSs cannot be extended much beyond what they already have to offer. Certain CMSs can be extended a little, but not by much more. Some CMSs can be extended, but only at the cost of learning complex APIs and methodologies that are speciﬁc to the CMS. There are also some CMSs that allow extendibility with just the knowledge of the programming language in which they were written.
Content management systems are used when one wants to create a site that can be self-maintained. It really does replace a programmer for maintenance. The websites for most companies have simple workﬂows, if any. And there are a lot of individuals who would like to have a website for themselves, just like everyone wanted to have a business card. Content management systems avoid having to pay professional rates for simple websites when you can create and maintain such sites yourself. You might want to use a professional to initially create the website, but still maintain it yourself in order to provide a quicker turnaround time in updating new content. These are situations where a CMS like MODx provides a solution.
Application frameworks take over where the limitations of CMSs begin—when you want more than what is possible. To use any application framework, you must know the language it uses. But if you really want to develop, then you better be a programmer—but a smart one who lets the system handle "the obvious things"!
MODx provides the ease of a CMS and the extendibility of a framework, which is made possible by exposing a new architecture that is both easy and ﬂexible. It is possible to create very complex and custom sites in MODx. Hence, one can start developing a complete site in MODx without any programming knowledge and use expertise only for the elements that need programming skills, if they are needed.
Another interesting concept of MODx is how it handles templating. Unlike most CMSs available, there is no need to learn any templating language in order to introduce a theme to your site. Hence, it does not even have the small learning curve of a templating language.
MODx is designed to be intuitive; hence, it is easy for anyone to understand how to create sites quickly and effectively. Once you have learned the basics, you will realize that the experience keeps getting better.
MODx administration is AJAX-driven, giving you the ability to manage the site with abilities that are very user friendly. Sites created with MODx can also have AJAX-enabled features without much effort. Many built-in snippets, such as the AJAX search snippet available for MODx, come with interesting AJAX functionalities that can be used out-of-the-box.
MODx is search-engine friendly, which means that it has everything to help you get your site listed on Google or any other famous search engine.
MODx is an open source project and, like most open source projects, it has strong community support. There are countless places from which to get help when you are stuck, and almost all queries get answered within a day. Moreover, having community support means that support will keep getting better.
All of this makes MODx suitable both for a casual developer who would like a quick site and also for serious developers who want something easy to start with and the option to build sophistication gradually. MODx uses an architecture that helps to overcome most of the disadvantages mentioned under application frameworks and CMSs while retaining their advantages.
This book teaches you how to use MODx to create powerful, dynamic websites, even without the knowledge of a programming language. It leads you step-by-step, in a logical pattern, through building a complete website. Each chapter covers certain concepts, and includes simple examples. All of the examples, if you follow along, aggregate to a self-created website. The book also includes a chapter dedicated to the serious programmers who would like to extend what they can do with MODx.
This book can also be used as a reference or to relearn the particular concepts that have been discussed in each chapter. It has illustrative examples, wherever necessary, to make sure that it is friendly. It has a mixture of simple demonstrations and in-depth concepts that will interest both casual and serious readers.
In this chapter, you have learned the general concepts of web development and also been assured as to why MODx, as a tool, is a good choice for developing your website. The various development methodologies, especially a CMS and a Web Application, Framework have been explained. With these briefings on the fundamentals, you should have a clear understanding of what MODx is and why you would want to use it.