Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Joomla中将引导类添加到JHtml_Joomla_Joomla3.0_Bootstrap Sass_Jhtmlarea - Fatal编程技术网

如何在Joomla中将引导类添加到JHtml

如何在Joomla中将引导类添加到JHtml,joomla,joomla3.0,bootstrap-sass,jhtmlarea,Joomla,Joomla3.0,Bootstrap Sass,Jhtmlarea,我正在使用下面的代码来显示我从gravatar.com获取的图像,所以我想使用一个引导CSS类来使它更具吸引力。当我添加样式而不是显示图像时,它会显示指向图像的链接,当我重定向到链接时,我可以看到图像。为什么我会得到这个 $html[] = JHtml::_('image', $grav_url,'class="img-circle"', JText::_('PLG_CONTENT_AVATAR'), null, true) 这里$grav_url是我获取的图像url,img circle是我

我正在使用下面的代码来显示我从gravatar.com获取的图像,所以我想使用一个引导CSS类来使它更具吸引力。当我添加样式而不是显示图像时,它会显示指向图像的链接,当我重定向到链接时,我可以看到图像。为什么我会得到这个

$html[] = JHtml::_('image', $grav_url,'class="img-circle"', JText::_('PLG_CONTENT_AVATAR'), null, true)

这里$grav_url是我获取的图像url,img circle是我想要使用的引导类

我相信您正在使用的库就在这里:

因此,您可以在参数列表中看到$attribs有一个参数,它属于数组类型。另一件事是,您必须传递一个额外的$alt参数,它可能是您的jtext刚刚出了问题。要将其传递给方法,请执行以下操作:

$html[] = JHtml::_('image', $grav_url, JText::_('PLG_CONTENT_AVATAR'), array('class'=>'img-circle'), true)
或者,您可以在方法外部构建数组作为变量:

$attribs = array();
$attribs['class'] = 'img-circle'; // I think this should work? haven't tested though.

$html[] = JHtml::_('image', $grav_url, JText::_('PLG_CONTENT_AVATAR'), $attribs, true)