当我在模板中插入minicart模块时,空的textnode被添加到HTML代码中。问题是如何摆脱这个文本节点。
我的index.php文件中的代码
</div><jdoc:include type="modules" name="minicart" />
这是我的minicart.tpl.php
<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
<div id="cartPanel" class="main">
<div id="cartWrapper">
<?php if(!$vmMinicart) { ?>
<a href="index.php?page=shop.cart&option=com_virtuemart" target="_self">
<?php } ?>
<div id="cartIcon"><img alt="Корзина" src="/templates/denas/images/bag-icon.png" /></div>
<div id="cartInfo"><span>
<?php
$qnt = 0;
// Loop through each row and build the table
foreach( $minicart as $cart ) {
foreach( $cart as $attr => $val ) {
// Using this we make all the variables available in the template
// translated example: $this->set( 'product_name', $product_name );
$this->set( $attr, $val );
}
if(!$vmMinicart) { // Build Minicart
?>
<?php $qnt = $qnt + $cart['quantity'];
}
}
echo $VM_LANG->_('PHPSHOP_PRODUCT_COUNT_NAME').': '.$qnt.' '.$VM_LANG->_('PHPSHOP_PRODUCT_FORM_UNIT_DEFAULT');?>
</span>
<span>
<?php if ($total_price != '') echo $VM_LANG->_('PHPSHOP_PRODUCTS_PAYS').': '.$total_price; ?>
</span></div>
</a>
</div>
</div>