Today is doing a product site I use a set of Ecshop template, this set of templates downloaded mostly can be used, but I found that the first screen of the home ads have been not displayed I think a lot of ways are not shown, and then a webmaster told me how to solve, Let me introduce the implementation method of Ecshop call Flash advertisement.
My default is that the Index_ad.lbi template has a $flash variable, but not found in search search
<!--{foreach from= $flash Name=no item=flash}--> <liclass="li{$smarty. foreach.no.iteration}"><a href="{$flash. URL}"target="_blank">"{$flash. src}"/></li><!--{/foreach}--><!--{foreach from= $flash Name=no item=flash}--> <li>{$smarty.foreach. no.iteration}</li> <!--{/foreach}-->
Then I searched for the flash variable in the index.php file no, only found such a code
/*Home main ads Settings*/$smarty->assign ('Index_ad', $_cfg['Index_ad']); if($_cfg['Index_ad'] =='cus') {$sql='SELECT ad_type, content, url from'. $ecs->table ("Ad_custom") .'WHERE ad_status = 1'; $ad= $db->getrow ($sql,true); $smarty->assign ('AD', $ad);}
Found no way to use, I call will not show advertisers ads, so search the Internet to see a paragraph of such text
On the homepage index.php code: $smarty->assign (' Shop_notice ', $_cfg[' Shop_notice ']); Shop Announcements
Add the following code below this code:
$smarty->assign ("flash", Get_flash_xml ()); $smarty->assign (' Flash_count ', Count (Get_flash_xml ()));
If the above two steps do not call home main ads, and then add the following code index.php:
/** * Home Display the code required for the main ad area * @return Array*/functionGet_flash_xml () {$flashdb=Array(); if(file_exists(Root_path. Data_dir. '/flash_data.xml ')) { //compatible with v2.7.0 and previous versions if(!Preg_match_all('/item_url= ' ([^ "]+)" \slink= "([^"]+) "\stext=" ([^ "]*)" \ssort= "([^"]*] "/',file_get_contents(Root_path. Data_dir. '/flash_data.xml '),$t,Preg_set_order)) { Preg_match_all('/item_url= ' ([^ "]+)" \slink= "([^"]+) "\stext=" ([^ "]*)"/',file_get_contents(Root_path. Data_dir. '/flash_data.xml '),$t,Preg_set_order); } if(!Empty($t)) { foreach($t as $key=$val) { $val[4] =isset($val[4])?$val[4]: 0; $flashdb[] =Array(' src ' =$val[1], ' url ' = =$val[2], ' text ' = =$val[3], ' sort ' =$val[4]); } } } return $flashdb;}
Ecshop How to use the slideshow page main AD display