The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: xxx | January 25, 2010 @ 6:38am
PHP Code
[
Download
]
<?if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' && Mage::getSingleton('cms/page')->getIdentifier() == 'home'){?> <?if($_SERVER['REMOTE_ADDR'] == '193.77.150.182'){?> <?$cat = Mage::getModel('catalog/category')->load(17);?> <?$count = count($cat->getProductCollection());?> <script type="text/javascript"> function showSub(){ for(var i = 1; i <= <?=$count;?>; i++){ if(i == Math.random(1-<?=$count;?>)){ document.getElementById('img'+i).style.display = 'block'; }else{ document.getElementById('img'+i).style.display = 'none'; } } } </script> <? $rand = rand(1,$count); $i=0; foreach ($cat->getProductCollection() as $product){ $i++;?> <?$_product = new Mage_Catalog_Model_Product();?> <?$_product->load($product->getId());?> <div style="display: <?if($i==$rand) echo 'block'; else echo 'none';?>;" id="img<?=$i;?>"> <center> <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(500, 310); ?>" /><br /> <?=$_product->getDescription();?> </center> </div> <?}?> <script type="text/javascript"> setInterval(showSub(),1000); </script> <?}?> <?}?>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.36 / 8
58 Votes
http://codebin.yi.org/461
page generated in 0.00 seconds