Dynamic Joomla! Content Pages

Joomla! is a good CMS as far as CMS’s go, but as with any piece of software, it has it’s limitations. Of course it can’t be all things to all people, but it does a fairly good job.

Recently I was looking to create some content pages using Joomla!’s article setup. The idea was to create ‘articles’ about certain products to be used for landing pages. These pages would have product specific information which was already contained in the Virtuemart database. I thought it relatively silly and un-DRY to have to recreate the content in this new page when it already existed in another part of the site. Not to mention the hassle of having to make sure the two remained consistent (such as prices or product names).

Normally I would just write some PHP/MySQL to handle this but of course that isn’t allowed natively within a Joomla! article and for good reason. Fortunately I found two Joomla! Extensions that do the trick nicely.

RunPHP

This allows you to write PHP right in the article by wrapping it in {runphp}{/runphp} tags. This is super handy and works great. I’m able to pull data from my Virtuemart database and drop it right into the article, as well as have more conditional control over different aspects of the article content.

MosSnippet

This Mambot is neat because it allows you to use multiple languages and markups with standard syntax (as opposed to RunPHP which obviously only works with PHP).   The only drawback is that you have to pre-write these snippets in the administrative side of this Mambot before you can use them in your article.  So you write your code and save it as a snippet in the Mambot (you have 15 slots available by default) and then you can call it in your article by using {snippet name} replacing ‘name’ with the actual name of your snippet.  This works well if you have a snippet of code you use repeatedly (such as dynamic tracking code perhaps?) and is nice because you can use multiple programming languages.

Comments (1)

Comments are closed.