0
votes

I'm looking to modify the "Category Blog Layout" in Joomla 1.5. I want to modify it such that even article rows are right aligned and odd ones are left aligned. I'd like to do this to the article title as well, hence using html or css (page class suffix in params) in the article body itself is not an option as it only affects the table html (contentpaneopen) generated by the following two files for each blog item's text:

\components\com_content\views\category\tmpl\blog.php \components\com_content\views\category\tmpl\blog_item.php

I am guessing, I need to overload these two files in my custom template to achieve what I want. Problem is I don't see how to access the row number that blog_item.php is dealing with.

I have found that ContentViewCategory::getItems in \components\com_content\views\category\view.html.php has the following lines of code:

$item->odd      = $k;
$item->count    = $i;

But I can't figure out how to access these.

Any ideas?

PS: This is the kind of layout I want to achieve:

---------------------------------------------------
|   --------------   ---------------------------- |
|   |            |   |                          | |     
|   |            |   |                          | |     
|   |   row 1    |   |      row 1 text          | |
|   |   Image    |   |                          | |
|   |            |   |                          | |
|   |            |   |                          | |
|   |------------|   |--------------------------| |   
--------------------------------------------------|
---------------------------------------------------
|   |--------------------------| |--------------| | 
|   |                          | |              | |
|   |                          | |              | |     
|   |      row 2 text          | |    row 2     | |
|   |                          | |    Image     | |
|   |                          | |              | |
|   |                          | |              | |
|   |--------------------------| |--------------| |   
--------------------------------------------------|
---------------------------------------------------
|   --------------   ---------------------------- |
|   |            |   |                          | |     
|   |            |   |                          | |     
|   |   row 3    |   |      row 3 text          | |
|   |   Image    |   |                          | |
|   |            |   |                          | |
|   |            |   |                          | |
|   |------------|   |--------------------------| |   
--------------------------------------------------|
2

2 Answers

0
votes

I hate to answer my own question, but once I was able to debug Joomla, this turned out to be a lot simpler than I thought. I overloaded these two files:

\components\com_content\views\category\tmpl\blog.php \components\com_content\views\category\tmpl\blog_item.php

in my custom theme folder:

\templates\\html\com_content\views\category\tmpl\blog.php \components\\html\com_content\views\category\tmpl\blog_item.php

Following is the one liner I added to blog.php:

$this->assign('itemIndex', $i);

before calling:

echo $this->loadTemplate('item')

Now I can call $this->itemIndex in blog_item.php to get the row index and do what I want with it.

0
votes

What about a more ordered one? Like creating thumbnails with one size in one side, the same introtext and title fonts anall