Still In Development


Login



Changing the Article Layout PDF Print E-mail
Joomla - Template Development
Wednesday, 12 May 2010 09:15

The problem was: Joomla's default article view puts the article content in a table.  I wanted the content to flow around floating positions in the template.

I don't have a strong opinion on the ages-old dead horse: use of tables versus divs in layouts.

However, having the article layout rendering the content in a table was causing problems for the way I wanted this blog site to layout.

The good news is, you don't have to mess with the Joomla core files to change that.  And you can chage it on a template-by-template basis.  Here's a great link with lots of information about using this technique with Joomla.

All I did, was create a directoy under my template called "html".  Under that, "com_component-name" (com_content) and under that, "view-name" (article).  So if my template is called "awd" I made:

/templates/awd/html/com_content/article

and in that "article" folder I put a copy of the default.php file I found here:

/components/com_content/views/article/tmpl/default.php

Except I made one change to "my copy" of the article layout file, I moved the line:

<?php echo $this->article->text; ?>

just below the last </table> tag.

This had the effect of letting my article content "flow around", say, the floating right div.

Similar technique could be applied to any com_content view (and in general any MVC component view!).  So you awesome purists out there can develop tableless templates for Joomla.  I don't mind the use in blog layouts... since I think of that as tabular data.  Just not the content body please!

And by the way, once I finished I discovered that my PDF icons didn't work in IE8.  It turns out that wasn't related to the change described in this article, but was another issue altogether.