Page 1 of 1

Adding Category titles in categories view

Posted: 01 Apr 2011, 01:58
by mozzy
Hello,

I've been trying to modify the code in the default categories file /categories/tmpl/default.php to add a "title" to the thumbnail image tags. I'd like to have the category title appear on mouse over but I have limited knowledge of using JHTML expressions and variables. The titles appear on each of the category pages but not in Categories view.
http://www.benquilty.com/bqcms/


I was wondering if someone could help or point me in the right direction.

The original line 89

Code: Select all

echo JHTML::_( 'image.site', $this->categories[$i]->linkthumbnailpath, '', '', '', str_replace('»', '-',$this->categories[$i]->title), 'style="border:0"');
Here's my edit.

Code: Select all

echo JHTML::_( 'image.site', $this->categories[$i]->linkthumbnailpath, '', '', '', str_replace('»', '-',$this->categories[$i]->title), 'style="border:0" title="{$this->categories[$i]->title}"' );
I've tried adding the categories title variable following the border style but it only parses the string, not the variable value. Probably something straightforward but I can't see it. :x

cheers
Mitchell

Re: Adding Category titles in categories view

Posted: 02 Apr 2011, 06:10
by mozzy
Anyone have any ideas?

Re: Adding Category titles in categories view

Posted: 08 Apr 2011, 13:31
by Jan
Hi, not on my PC now :-( so cannot give right advice, but just try to look to Joomla! framework API to see JHTML and there you should see the parameters for it.


Jan

Re: Adding Category titles in categories view

Posted: 16 Apr 2011, 18:51
by mozzy
Thanks for the tip, Jan.

For anyone that needs this, here's the edited code. The array of additional attributes is the key.

Code: Select all

echo JHTML::_( 'image.site', $this->categories[$i]->linkthumbnailpath, '', '', '', str_replace('»', '-',$this->categories[$i]->title), array('title'=> str_replace('»', '-',$this->categories[$i]->title)),'style="border:0"');

Re: Adding Category titles in categories view

Posted: 18 Apr 2011, 18:49
by Jan
Ok