ECShop calling a custom ad

Source: Internet
Author: User

Original address: http://www.ecshoptemplate.com/article-1348.html

Ecshop about the call method of advertising, there are many online, now to introduce different from other, according to the actual situation to choose to use, the first page call as an example:

1. Add the calling function on the index.php page:

/** Call AD bit*/functionIndex_ad_diy(){$sql= ' SELECT* FROM '. $GLOBALS[' ECS ']->Table(' Ad '). ' ORDER by end_time ASC '; $res= $GLOBALS[' DB ']->GetAll($sql); $arr=Array();Foreach($res as $idx= $row){$arr[$idx][' ID ']= $row[' ad_id ']; $arr[$idx][ ' title ' ] = $ Row[ ' ad_name ' ; $arr [$idx ][ ' Imglink '  = $row [ Ad_ Link ' [$idx ][ ' Imgcode '  = $row [ Ad_ Code '  return $arr ;}  

2. Add the code of the parsing template to the index.php page

Locate the following code:

Assign_template();

Add in the inside:

/* Custom AD bit call */$smarty-assign(' Ad_diy ',   index_ad_diy//Custom AD bit call   

3. Locate the Themes\mjmn\ current template folder \index.dwt file and add the code where you want the ad image to be looped:

<!–{foreach from= $ad _diy Item=diyad}–><li><div><a Title="Href=" {$diyAd. Imglink} "target=_blank>{$diyAd .title|escape:html}</a><p></p></div> <div><a id=vstagbt href= "{$diyAd. Imglink}" Target=_blank></a ></div><div><a title= "{$diyAd. title|escape:html}" href= "" Target=_blank>{$ Diyad. Title|escape: HTML}</a></div></li><!– {/foreach}–>               

Ok! Successful implementation of the function

ECShop calling a custom ad

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.