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