0
有沒有辦法顯示2個橫幅(沒有複製相同的橫幅?) 換句話說,我不能只重複「回聲」代碼,因爲然後它可以隨機選擇相同的橫幅兩次。有沒有一種方法,使2個隨機選擇的橫幅?:使用PHP和Magento靜態塊創建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>'); ?>