Ecshop How to use the slideshow page main AD display

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.