此代码用于显示virtuemart产品图片:
$result = array();
foreach ($airport_array[$airport_row['airportICAO']] as $arrays)
{
if($arrays['airportUserCount'] == 0) {
array_push($result, $arrays);
}
}
输出前端网站上的代码:
<div class="img-wrapper">
<?php
$image = $product->images[0]->displayMediaThumb('class="browseProductImage featuredProductImageFirst" id="Img_to_Js_'.$product->virtuemart_product_id.'" border="0"',false) ;
if(!empty($product->images[1])){
$image2 = $product->images[1]->displayMediaThumb('class="browseProductImage featuredProductImageSecond" border="0"',false) ;
} else {$image2= $product->images[0]->displayMediaThumb('class="browseProductImage featuredProductImageSecond" border="0"',false) ;}
echo JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),'<div class="front">'.$image.'</div><div class="back">'.$image2.'</div>');
?>
</div>
现在,我想要将课程添加到<div class="img-wrapper">
<a href="link to product">
<div class="front">
<img show_image1_product >
</div>
<div class="back">
<img show_image2_product >
</div>
</a>
怎么做?
答案 0 :(得分:0)
JHTML
链接接受关联数组作为第三个参数(如docs所示),因此您可以使用["class"=>"classname"]
编辑:完整的代码行以便更好地理解,documentation
中的解释很好JHTML :: ( 'JoomlaClassName', JROUTE :: ( 'UrlOfLink'), 'TextWithFrontBackDivs',关联数组);
JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),'<div class="front">'.$image.'</div><div class="back">'.$image2.'</div>', array("class"=>"classnane"));