In Part I of "Joomla vs. WordPress" we got a basic introduction to open source and a basic introduction to Joomla and WordPress. We also saw some pros and cons of Joomla and Wordpress. In this article we will see Joomla and WordPress in more detail, covering a few technical topics related to both of the CMS.
Joomla Main Tenants
Joomla has four main tenants:
Component – is a kind of Joomla extension. Components are the main functional units of Joomla, which carry most of your project’s logic. Components are themselves mini applications. If we were to try to understand it using an easy analogy, then it would be like Joomla is an OS (Operating System), whereas components are the installed applications on the OS like MS Word, etc.
Components are mostly split into two parts: an administrator part and a site/front-end part. The front-end part is what users see on the main site; these are the normal site operations. On the other hand, the administrator part, which is accessible from the Joomla administration section, provides an interface for configuration and management of different sections of the component. For Example, content/articles is a built-in core component of Joomla. The article you see on the website is coming from the site/front-end part. On the other side, if you are going to login from the administrator section, you will see a “Content” link on top of the menu and from here you will manage all of your articles that need to be shown on the front-end. Other examples include contact forms and web links.
One good thing about Joomla components is that they are mostly based on MVC (Model View Controller) design patterns. Developing Joomla components is very organized in terms of coding and the coding structure is also very easy to follow if you already have experience with the MVC design pattern.
On the front-end, according to the Joomla architecture, you can show/render only one component at a time. If you want to show multiple components at a time on a single page you need to install a plugin named “Plugin Include Component” and call any component inside the article without an iFrame.
Module – is another type of Joomla extension. Modules are much more lightweight and flexible when used for page rendering. Modules are not like components; they only perform limited functionality. Modules are kind of like “boxes” arranged around a component on a page. Remember how Joomla is like the OS and components are like applications installed on the OS? Modules are like small applications, like a weather widget running on the desktop.
A very well known example of a module in Joomla is the “Login Form” module. Modules are assigned per menu item, so the choice is yours; either you want to show that module on a specific page or not.
Modules appear on placeholders called “Positions,” which are defined in the templates. You can call as many modules to a single position as you want. The order is set from the Modules manager in the administrator section. Also, each page has multiple positions. Modules are not like components, because you can only display one component at a time on a single page. You can show multiple modules in multiple positions on a single page.
Working with modules ensures that a module is enabled from the administrator section and that it is assigned to a position that already exists in the template file. The module is also assigned to the page where you are testing it.
Plugin – provides functionality that is associated with any event. You can see a list of core plugin events at http://docs.joomla.org/Plugin/Events. Whenever a core event occurs, all plugin functions associated with that type are executed in sequence. Plugins only have limited functionality and also have a very limited number of files. Using plugins, you can achieve different kinds of functionalities. Plugins are not often used in normal projects; they are only related to special cases. Joomla installs core plugins by itself during installation. You can run your website without knowing more details about plugins.
Templates – are the extensions which can change the look and feel of your website. There are two types of templates: front-end templates and administrator/back-end templates. Front-end templates are used the most. They control the way your website is presented to the users viewing the website’s content. Back-end templates are related to the look and feel of your administrator section. Most the time it is not necessary to change the administrator/back-end template.
In Joomla, front-end templates are very well organized. There is a single file titled index.php for the template rendering, and it has all the defined positions. The definition of positions is inside the templateDetails.xml. One good thing about Joomla templates is that if you want to change the look and feel of your core login module, you can over-write its look and feel inside your template. You don’t need to change the core functionality. Joomla by default gives preference to the template html folder, where you put all of your customized core modules and component files.
WordPress Main Tenants
WordPress has four main tenants.
4. Post Type
Plugins – are extensions of WordPress. They allow easy modification, customization and enhancement of WordPress sites. One of the benefits of plugins is that you don’t need to change the core programming of WordPress. If you want to know if WordPress has some new or modified functionality to fulfill your requirements you should search various WordPress plugins repositories. It’s possible that someone has already developed/created a WordPress plugin that suits your needs. If not, then you will need to create your own custom plugin. For Example, if you want to run an ecommerce section on your website, you will have to install an ecommerce plugin. A good thing about the open source world is that if you have a plugin that is somehow able to fulfill your requirement, but not completely, then you can also enhance that plugin rather than develop a plugin from scratch.
In the big picture, plugins are similar to components in Joomla. Plugins are the tools to extend the functionality of your WordPress website. Unlike the Joomla components that are using the MVC design pattern, there are limited plugins that use MVC. However, these days more WordPress plugins are being developed according to the MVC design pattern.
Unlike Joomla files, WordPress files are not split up into two sections (i.e. front-end and backend). All of the administrator and front-end code exists in a single plugin folder. The main attraction for WordPress plugins are “Hooks”. Many WordPress plugins accomplish their goals by connecting to one or more WordPress Hooks. WordPress checks to see if any Plugins have a registered function to run when an action is triggered, and if so, the functions are run. These functions can enhance/modify the default behavior of WordPress.
It’s a WordPress standard that while developing a plugin, all JS files should be “hooked” to the wp-footer. So when the wp-footer function calls, all JS files automatically appear in the footer.
WordPress plugin hooks are split up into two types: “Actions” and “Filters." Actions are more like a trigger, whereas filters can filter your content before displaying it or saving it inside the database.
Widgets – provide a simple way for users to control the design and WordPress theme for their website. In other words, widgets are small modules that offer user drag and drop sidebar content placement throughout the implementation of a plugin’s extended abilities. Widgets are somewhat like Joomla’s modules.
Themes – allow users to change the look and feel of their WordPress website. Themes are basically the same as Joomla templates. The only difference is that you have multiple files for themes in WordPress for different pages, whereas Joomla has one single file that is responsible for showing themes. In WordPress you can create a theme page and directly assign it to any page from the admin section. This is different from Joomla, where you need to install different templates and can assign them to menu items.
WordPress introduced the child theme concept, which is basically a theme that can inherit another (or parent) theme’s functionality. It also allows you to modify or add to the functionality of that parent theme.
Why do we use child themes? The answer is simple: it is the safest and easiest way to modify an existing theme, whether you want to make a small change or a big change. Instead of modifying the theme files directly, you can create a child theme, as child themes inherit all of the parent theme’s functionalities. It allows you to make changes (like upgrades) to the parent theme that will be reflected on the child theme, though code in the child theme overwrites code in the parent theme. Also if you are going to upgrade your existing theme you will not lose your changes. You can upgrade your parent theme and you can still keep your changes in your child theme. It can also speed up your development time.
Post Types – to understand post types we first need to understand what posts are. WordPress can hold and display many different types of content. A single item of such content is generally called a post, though each post also has a specific post type. WordPress stores all post types in the same place. You will find all of your posts in the wp_posts database table, and different post types are differentiated in a column named “post_type.” WordPress 3.0 and newer versions of WordPress give you the ability to add your own custom post types and you can use them in different ways.
Post and page are the default post types that are available upon the installation of WordPress. There are a few others like attachment, revision and navigation menu.
Post in WordPress is a post type that is mostly used for blogs. These are mostly used to display blogs in LIFO order (newest post first), and they’re also used for creating blog feeds. Page in WordPress is also like a post, but you can use different page templates with the pages, something you can’t do it with post. Also pages can be organized in a hierarchical structure. Pages can be parents to other pages, but they can’t assign categories and tags.
Each of these popular CMS have different tenants and features, but the above information should help users choose which CMS best fits their needs.