简体   繁体   English

将类添加到PHP echo JHtml

[英]Add class to PHP echo JHtml

I'm trying to add a class to the image below: 我正在尝试向下面的图像添加一个类:

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

I tried the solution on this topic but it didn't work. 我尝试了有关该主题的解决方案,但没有成功。

The result I'm trying to achieve is to add class="scale" to the <img> tag. 我想要达到的结果是将class="scale"添加到<img>标记。

You should try: 你应该试试:

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

That should work. 那应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM