Lightweight MVC Frameworks like Codeigniter, CakePHP, and Symfony help speed up the process of building your web applications. However, many times you want to get up and running with your websites even faster than these core frameworks can afford. Often times, we find that content management systems can offer developers a simple and robust system for creating pages, themes, and layouts for your web applications. It's not going to write the intricate logic of your web app for you, but using an extended CMS can send developers off in the right direction. Let's talk about an extended CMS that I recently ran into that certainly seems to fit the bill, PyroCMS.
What is PyroCMS?
PyroCMS is a lightweight, themable, and dynamic modular content management system built as an extension to the CodeIgniter framework. PyroCMS offers extended security features, customizable themes, web integrations for sites like Twitter, and a simple administration interface for managing your web application's content.
To get started with PyroCMS, it's important to have the following software/services installed and ready to go:
- An HTTP Server (i.e. Apache 2.x)
- MySQL 5.x or higher
- PHP 5.2.x or higher
- PHP GD 2
The installation of PyroCMS is fairly straightfoward:
1 - First, download PyroCMS and extract the files to your web-server.
2 - Apply the following file permissions to your files:
chmod 777 codeigniter/cache
chmod 777 codeigniter/logs
chmod -R 777 application/cache
chmod 666 application/config/config.php
chmod 666 application/config/database.php
chmod -R 777 application/uploads
chmod -R 777 application/assets/img/photos
3 - Run the installer, this can be done by navigating to the /installer page. This will ask you to set up the database and create your config files.4- Lastly, get rid of the installer directory.
5 - Your installation is complete at this point. Hit your web root, login as "email@example.com" with the password "password" and make an admin user account.
6- Login with this new account, and then delete firstname.lastname@example.org from the accounts database.
Creating a Module
For development, there are two kinds of modules that can be created: core modules, and third_party. For each module directory, they can contain these directories: config, controllers, helpers, libraries, models, views, js, css, img.
Every module contains an XML file called details.xml. It is used to contain the metadata about the module, and whether it belongs to the frontend or the backend of the application.
With PyroCMS you have a total of four controller types: Controller, MY_Controller, Admin_Controller, and Public_Controller. Each of these controllers can be used depending on whether or not the page is public, or requires a user to be logged in. You can of course bypass the use of these controllers and use the normal CodeIgniter controller class, or find use for these extended controller types for added flexibility.
Creating a Theme
PyroCMS uses themes so that you can easily change the look and feel of your website. Strikingly similar to the RubyOnRails framework, PyroCMS has a master layout file and multiple partials that share its presentation logic between different views. Most of the information on creating views can be located in the Designer's Guide documentation. Themes in PyroCMS use the Template library, which aids in building complex views with the CodeIgniter framework.
Take a look at PyroCMS and determine if its extensions and added functions can help you to 'fire up' your web development.