添加 class 所以 PHP HO Jahtamal

Add class to PHP echo JHtml

我正在尝试为下图添加 class:

<?php 
   echo JHtml::_('image', 
                 $item->thumbnail,
                 $image_width, 
                 null, 
                 $this->escape($item->title)); 
?>

我在 this topic 上尝试了解决方案,但没有成功。

我想要达到的结果是将 class="scale" 添加到 <img> 标签。

你应该试试:

JHtml::_('image', $item->thumbnail, escape($item->title), array('class'=>'scale', 'width'=> $image_width));

应该可以。