MODx CMS overview
Some MODx related post discussing MODx cons is also here.
0. Intro
Today I am going to say something about MODx CMS.
At the moment I have used it to make one website as well as I am using it right now to make another. This is mainly the suggestion of the client, so I am using it not because I like it so very much, but just because of circumstances.
So far my experience with it is, actually, quite pleasant. MODx CMS has a lot of fine features. At the moment I can tell that it at least has the minimal things that are required to make a website. So far I have understood, that most of the MODx functionality relies on the following things: templates, template variables (TV), chunks and snippets. All the other things are quite auxiliary.
So, let us take a look and see what those are.
1. Templates
Templates are templates. I think that any PHP programmer should be familiar with the idea of those. OK. So what about the MODx templates? Well, I must say - MODx templates are not the best out there. And probably anybody who used Smarty (I am a fan
) will feel the same about the MODx templates. Imagine a situation - there is a template variable - URL of an image you want to show. Obviously your template code is something like this:
<img alt="MyTemplateImage" src="[*image_url*]" />
Very simple, huh? But what if the user leaves this variable empty? Then you will get the following code:
<img alt="MyTemplateImage" src="" />
Which is horrible! Absolutely horrible. This leaves two options:
- Make the user input the whole <img ... /> code. Though this is unacceptable, since most of the client I met do not have any idea that there is "markup" in the world.
- Do not show the image at all
So, basically what I am trying to say is - there are no logical operators in templates by default! Yes, by default. There is a add-on called PHx (Placeholders Xtended), which makes this thing possible, though the syntax is horrible (I guess due to the MODx template syntax). Take a look at the solution of our problem:
[+phx:if=`[*image_url*]`:is=``:then=``:else=`<img alt="MyTemplateImage" src="[*image_url*]" />`+]
And of course, just as a comparison, the beauty of Smarty:
{if $image_url neq ""}
<img alt="MyTemplateImage" src="[*image_url*]" />
{/if}
This is what makes the difference. In MODx+PHx I would have to use a workaround to solve this. And if I have a larger chunk of code - I would have to separate it into a chunk.
Now, you might have the impression that I hate MODx. That is not true. At the moment I am trying to point out some of the bad sides I found.
2. Tamplate variables
Template variables (TV) are custom variables you want user to be able to insert into the page template. E.g. the [*image_url*] in the previous part was referring to a TV. You can create a new TV in the manager area of MODx and then assign which templates have access to that variable. Right after that any page using one of those templates will have an additional field below the content editor, where the user can change the TV content. In our case with [*image_url*] we would want to set it's type to Image and the user will have the opportunity to upload an image or enter a URL of an existing image. The image TV will also have a nice preview. A nice way to help simple customers adjust the appearance and/or the content of the website.
3. Chunks
Now it is time to talk about chunks. What are they? They are simply chunks of HTML code that make the templates look neat and clean. E.g. usually in a page you would have a header, a sidebar, content space and a footer. So this is what chunks are made for (basically) - you put those parts into separate chunks and then your template itself looks like this:
{header_chunk}
{sidebar_chunk}
<div id="content">[*content*]</div>
{footer_chunk}
So this is a matter of neatness and separation of different page areas. Besides that - chunk are small templates themselves. This means that you can use other chunks within them, you can use variables and snippets. I like the idea and implementation of these.
4. Snippets
Snippets are like chunks. Except that they are mostly used with PHP code. E.g. if you your website to show current date - you will not use a chunk, since it must not contain any code. You would create a snippet, which returns the date. There are a couple of snippets that are really useful that come in the default package of MODx. Such as Wayfinder (can generate a menu for example), Ditto and Breadcrumbs. And, I actually do not know what else can I say about them
5. Conclusion
In the end. I want to say that the overall feeling about the whole MODx CMS was pretty Ok. It has everything to be a nice CMS for a website. Quite an easy installation procedure, some fine-tuning capabilities, templates and so on. I would definitely advise you to at least try it out and decide for yourself if you want to use it or not.
I would say that MODx CMS is almost ideal for small corporate websites. For larger projects it would require more tuning and messing with add-ons (e.g. PHx). It can also be a pretty good blog engine (I tried it out, but requires a lot of tuning if you want a feature-rich blog), though I would definitely use a dedicated blog product like WP for blogs (and as you can see I am using WP) .
Thanks for your attention. Post comment if you have any.
September 18th, 2011 - 15:18
Definitely believe that which you saidYour favorite reason seemed to be on the web the simplest thing to be aware ofI say to you, I certainly get irked while people consider worries that they plainly don’t know aboutYou managed to hit the nail upon the top and defined out the whole thing without having side-effects , people could take a signalWill likely be back to get moreThanks