Loading...

Developing a website with Joomla

2021-09-02 14:15:08
joomla.jpg

Joomla! is an open-source content management system (CMS), developed by contributors around the world, that is both simple for beginners and flexible and powerful enough for more experienced developers. Of course, this CMS, which has been in existence since 2005, has its limitations and the heaviness that can be expected from a community project on a global scale. But while recognizing that no software is perfect, Joomla makes it possible to develop a dynamic, secure, and multilingual site with a reasonable budget and proven technologies that are regularly updated. In particular, I recommend testing the latest Joomla 4 version, which is a highly anticipated modernization of the framework, in particular its asset management, and the CMS interface.

In addition, it is software that is not linked to the interests of a company, but which is legally under the leadership of an association (Open Source Matters). This non-profit legal structure promotes the interests of users in the long run, rather than the search for immediate profits by the developers of the software. This is an important criterion in the search for a sustainable technical solution for SMEs, government organizations, or associations. The lack of advertising for Premium versions that are increasingly intruding into the backends of modern CMSs is particularly pleasant.

Program without touching the heart of the application

Joomla is a complex open-source application that is regularly improved. It is therefore important not to alter its core to be able to update it easily as soon as a new version is announced. The good news is that there are plenty of ways to override or override existing source code, use the CMS's many custom fields, or create your own extensions.

The components (applications routing their own URLs like the content manager) and modules (display widgets) of Joomla conform to the MVC programming model (separation of logic and presentation). The user has the possibility to substitute the HTML / PHP code of each view by adding it in a folder named HTML inside the template folder, inject JavaScript or CSS code, and even creating alternative views. The administration interface allows you to quickly generate these overrides with one click in the template manager. Other interface elements, called Layouts, can be substituted in the same way. These files can be customized and will not be overwritten with the next update. Joomla 4 greatly improves its management by offering a change notification module and an editor integrated under CodeMirror with diff function.

joomla-integration

When these techniques do not do the trick, it is possible to program a third type of extension, a plugin, which modifies the overall operation of the application. For example, a plugin can add a new type of custom field, embed metadata or microdata on the fly in HTML code, encrypt email addresses or transform shortcodes into various more complex interface elements such as slide shows.

Change the appearance of the site based on pages and categories

The CSS code can be injected at different levels to modify the appearance of the site: in the template, directly in the articles, but also inside a module and outside (chrome module). Modules are enabled or disabled at will on each page or category assigned to a menu item. This is convenient, as modules can load their own stylesheets or JavaScript scripts, which allows very fine control over what gets loaded and when.

Joomla's menu manager also allows you to add class names to create CSS rules specific to a particular page or to choose a template style. An XML file is used to configure template styles like all other types of Joomla extensions. For example, it is possible to create a button for selecting a logo, a color code, or a simple text field without having to program the interface. It's really a big plus compared to other CMS. Joomla 3 is delivered with fewer files of the Bootstrap framework in version 2, while Joomla 4 uses SCSS and Bootstrap 5, which allows tailoring the responsive interface of the default Protostar / Cassiopeia template. It is also possible to install other libraries like Tailwind CSS, professional frameworks like Gantry 5 or Yootheme, even to develop in "flat files" with Pages of JoomlaTools which also emphasizes the improvement of the cache and performances (video).

Create your own extensions

Ok, the object-oriented programming interface is complex and can be confusing due to the presence of legacy code (related to old versions) and the need to navigate the Joomla class hierarchy. The documentation is in clear progress thanks to the regular contribution of volunteers and the organization of the files is tested. To save time, it is possible to create the skeleton of the extension that you want to develop with the Component creator or by downloading a boilerplate on Github. Indeed, creating the multilingual MVC structure of an extension and its configuration using XML and .ini files is the most daunting aspect. Better to automate what can be automated. Examining the source code of an extension installed by default by the CMS can be a good place to start. In addition, the JED (Joomla extensions directory) offers thousands of free or paid extensions that can be downloaded and installed directly from the CMS administration interface. But beware, the quality of their source code and their compatibility with the most recent versions of Joomla and PHP may vary. Some developers like Akeeba, JCE, RSJoomla, JoomlaTools, Simplifyyourweb, and Rockettheme are nevertheless to be recommended from my personal experience. Joomla is also known for its CCK-type development plugins (K2, Seblod, Fabrik, Flexicontent), but I haven't used them.

The command line

Joomla does not yet have a system as advanced as wp-CLI or artisan for accessing the CMS from the command line, but it is not complicated to create your own scripts in PHP. A good starting point is the CLI folder which contains some examples of scripts for its maintenance (deletion of the cache, cleaning of sessions). The very clear structure of the database allows practically everything to be done in a fairly simple way, with the possible exception of updates to the CMS and its extensions. The Joomla 4 CLI system, inspired by Symfony, should significantly improve this point.

Security

The security of a CMS on a server is a subject in its own right because of the risks associated with the lack of knowledge of new webmasters. However, by following the previous advice, it will be understood that updating the application and its extensions will already significantly improve the security of its site.

Joomla is considered "out of the box" as one of the most secure CMS in the words of the founder of Akeeba. It also comes with two essential plugins to improve the security of its site: Google reCaptcha filters the access of robots to forms and Google Authenticator protects access to the administration interface with a secret code modified every 30 seconds. . As explained previously, the JForm class allows you to easily define in an XML file the fields to be used, for example, to create the backend of a module, template, component or plugin, taking advantage of the security rules and API filters. Joomla. A team is ready to deal with security issues at any time, which no homemade CMS is able to offer. Many additional security rules can be included in the Apache server's .htaccess file to block attacks. If in doubt to secure your site, it is better to install an extension like Akeeba Admin Tools (paid version) which will create the rules for Apache / Nginx for you and offer additional protection, auditing, and alerting services.

whatsapp