CMS Made Simple Techniques of 2013

As the name suggests, CMS Made Simple is very easy to set up and get started with. However, when it comes to solutions requiring to customise templates and functionality, I see people struggling with similar problems. That’s often because there is insufficient documentation or people don’t know where to find it. The following techniques can often solve your problem or give a starting point.

What you need to know about Smarty

Smarty is the template engine CMS Made Simple is running. That means that everything stored under ‘Layout’ - ‘Templates’ is based on it, as well as pretty much all module templates. Knowledge of some basics is therefore crucial. A look into the manual for designers[1] helps a lot.

Modules assign all kind of variables to the template which you can access in both module templates and your global layout template. To get an overview over the template variables available at a certain point in the template simply call {get_template_vars}.

Another helpful ressource can be the respective module help. Since the English version is most likely to be up-to-date you may want to compare with the one in your native language if it is not English. A switch link was introduced in the 1.9 series.

If you have found what you need - let’s say a collection of items usually assigned by modules such as News - and you want to explore it further, the php function var_dump can come in handy. All php functions can be applied on variables as modifiers; they will then be called and passed the variable as an argument. In this example a it’d look like {$items|var_dump}. It will output detailed information about the variable which are best readable in the source code.

Along with the functions and modifiers comes with which are listed in the manual, there are some additional functions and modifiers added by the CMS made simple core or modules which are listed under ‘Extensions’ - ‘Tags’.

P.S.: Some basic examples of how to use Smarty can also be found in an Arvixe article by John Beatrice.

What you need to know about modules

The purpose of a CMS is obviously to make a website administrable without touching code. This means that there shouldn’t be any code in pages which can’t be created and edited by the WYSIWYG. Depending of what kind of content you want to wrap in some additional markup there are some great modules that can be widely used.

Giving control over complex layouts to an editor can sometimes be hard. You may want to give the editor a comfortable way to change header photos, to optionally display a contact block on some pages etc. Install AdvancedContent and GBFilepicker, change the default content type to ‘Advanced Content’ under ‘Site Admin’ - ‘Page Defaults’ and check out the module help of AC.

Listing stuff like testimonials, vacancies, products etc. can be easily achieved with ListItExtended. You can add all kind of custom fields to store the data you wish and put all your markup in the summary and detail templates. When you install it, you will find the standard set of field types like textfield, textarea or datepicker, but there are cool modules out there providing even more field types for ListIt so you can add e.g. an availability calendar[2], a filepicker[3] or a Gallery selector[3] or even integrate with Amazon S3[4].

Changing server

You will often need to move your installation of CMSMS to another server after you completed a web project to replace the old website or simply to move it from your server to your client’s one after you’ve got paid. This may seem more complicated than it is, because it is actually only a few steps.

  1. Clear the cache under ‘Site Admin’ - ‘System Maintenance’
  2. Download all files from your website’s root folder
  3. Get a dump of your database - if you don’t have access via remote connection, SSH or phpMyAdmin, you can use the module btAdminer
  4. Now upload all files to the new server
  5. If you can’t get access to the database in any traditional ways, you’re probably best of to download a standalone version of the adminer[5] which is just a single file - then import the database
  6. Change database settings in config.php
  7. Set the following access permissions:
    /modules/ - set to 777
    /uploads/ - recursively set to 777
    /tmp/cache/ - set to 777
    /tmp/templates_c - set to 777

And there you go!

If you're fortunate enough to have SSH access please see part 2 of this guide: How to move your CMSMS installation to a new server (2).

Troubleshooting

If you end up with a white page or other unexpected behavior, it can often help to switch on debug mode. This can be done by adding the following line to your config.php:

$config[‘debug’] = true;

References

1) http://www.smarty.net/docsv2/en/smarty.for.designers.tpl
2) http://dev.cmsmadesimple.org/projects/jsavailability
3) http://dev.cmsmadesimple.org/projects/listit2xdefs
4) http://dev.cmsmadesimple.org/projects/listit2amazon
5) http://www.adminer.org

ALL-INKL.COM - Webhosting Server Hosting Domain Provider

Comments