Introduction for developers

Before you begin to discover the wonders of X3 CMS let us see the pros and cons of this CMS.

Cons

  • does not have a community: you can partecipate, if you want
  • the documentation is poor: is an hard work that I can do only in my spare time
  • no modules and themes to download: maybe in the future

Pro in general

  • is not very common so is less susceptible to attacks
  • X3 CMS once installed is ready for posting content with little or no configuration
  • has been developed to meet real needs: versatility, flexibility, speed and security

Pro for developers

  • it is really simple, the structure of files and folders is clean and straightforward
  • to find out how the engine works you have just to open a dozen of files
  • X3 CMS has interesting features that many famous, backed by numerous community, adopted only recently or have not (e.g. PDO on Drupal comes only with version 7, the concept of areas, sections, the MVC engine and many other little niceties)
  • developing X3 CMS we have tried to minimize the necessary knowledge to manage it:  
    • php, mysql and javascript for the development of plugins
    • php, javascript and css for themes
  • X3 CMS is an application written on an MVC framework derived from Kohana (version 2.x)
    Although it is simple, it is an MVC framework that can be extended to add functionality to X3 CMS.
    It can also be used as a basis for developing web applications without the need to learn to use other instruments.

Who should use X3 CMS

  • young developers who want to experience on a CMS that they can really understand and disassemble
  • programmers who want a simple basis on which to develop medium and big projects

The goal

X3CMS is developed with the goal of having a tool that you can easily adapt to any project.
Many features in the design of a common job in a web agency are not needed and can seem like an unnecessary complication, experience has taught me that many projects are born small and then become complex and it is not advantageous to do it all over again.

Some examples:

  • Multi-language sites
  • Sites with one or more private areas
  • Public parts of sites with totally different graphic
  • Creation of landing pages delegated
  • SEO needs
  • Integration with external libraries
  • Use of multiple databases
  • Page caching
  • Complex layouts
  • Add pages with special features with plugins
  • Different groups of users (who manage the site, who insert contents and so on)
  • Granular control over each user's permissions on each individual object
  • Transform a website into a web application

X3 CMS is a tool made to allow the developer to address all these eventualities with no problems, with five clicks you install the CMS web site ready for a basic need and then, if you need, add the more.

How it works

All php files are handled by the framework, other files (txt, html, css etc..) are handled transparently.

Everything starts from the file page.php:

  • Define the PATH constants
  • Upload files config.php and X4Router_core.php
  • Launch the core X4Core_core.php 

The URL is analyzed in X4Core_core, eg:
http://website.com/language/area/controller/method/parameter_1/../parameter_n?query_string

NOTE: language and area disappear if you have a single language and single area in the website.

X4Core_core checks if there is a controller in the area (public in this example), example: the call to http://www.mysite.com/it/public/search will be redirected to /cms/controller/public/search_controller.php and will run the default method (named default).

If the controller not exists then X4Core_core calls the basic controller /system/controllers/X4Page_controller.php

This controller uses the value of the controller as page name and looks for it in the DB (table pages). If he finds the page and the page is active, displays the contents else it displays a blank page with error message.

In this way you can create pages with only content or special pages with additional features.

Model View Controller

At the base of X3 CMS there is an MVC framework. X4Core_core calls the controller and executes the method, the method calls the template and populates the view.

All interactions with the database (queries) are in the model that inherited some methods to perform with ease the most common queries.

Typically the result of the query is passed directly to the view, sometimes can be required to do complex manipulations so you have ad hoc methods in the controller or in the model or you can use helpers calls. Helpers are libraries with static methods.

X4Utils_helper.php is a library that contains the methods used in the presentation of the pages of CMS, other helpers are more specialized: X4Form_helper, X4Validation_helper, X4Files_helper and so on.

Additional features are implemented through libraries (usually installed with Composer), for example: mPDF to create PDF files. Libraries are typically carried out by third, to integrate them into the CMS there is a file that performs the necessary import and/or initialization for example /system/libraries/restler_library.php.

Forms

One of the strenghts of X3 CMS is the form handling. You can create very complex forms with complex validation rules.
All of the magic happens inside the form construction.

The down side was the construction of the array of the form's fields. With complex forms it could be very long.
Another limit was the dynamic construction of forms with sections of the form loaded dynamically.
Our solution has been to create another type of element that can be loaded like a view and that can be injected inside another.

This is probably one of the most important features we recently added to the project.

Have you a question?