有没有办法显示 2 个横幅(不重复相同的横幅?)换句话说,我不能只是重复“回声”代码,因为这样它可以随机选择相同的横幅两次。有没有办法制作一组随机选择的 2 个横幅?:
<?PHP
$collection = Mage::getModel('cms/block')->getCollection()
->addFieldToFilter('identifier', array('like'=>'ROMM-RFBanner_%'))
->addFieldToFilter('is_active', 1);
$blockCount = $collection->count();
echo ('<div class="footer-banner-boxes row clearfix">');
echo $this->getLayout()->createBlock('cms/block')->setBlockId('ROMM-RFBanner_'.mt_rand(1, $blockCount))->toHtml();
echo $this->getLayout()->createBlock('cms/block')->setBlockId('ROMM-RFBanner_'.mt_rand(1, $blockCount))->toHtml();
echo ('</div>'); ?>