The custom call advertisement method of Ecshop Mall website Construction (II.)

Source: Internet
Author: User

Original address:

When using Ecshop to build a mall website, many of the Ecshop default features are not used after our personalized design. Today we are mainly to analyze if custom call ad bit:
1. When calling a single ad bit we can use:
{Insert Name= ' ads ' id=37 num=3}
Here the ID is the ad bit ID number, this ID can be viewed through the background of the site, the management of the ad bit, num is only we have to invoke a few ads out.
2. When our ads use a lot of special effects, such as when we want to personalize the slide, using the Ecshop default style is not good, then we will use a lot of other jquery effect slides,
So we're going to have to be very flexible in calling ad positions. First of all: we're going to open includes/lib_goods.php
At the end of the document, add:

function Index_ad_diy ($prositionid) {$sql = ' SELECT * from '. $GLOBALS [' ECS ']->table (' ad '). ' WHERE position_id= '. $prositionid. ' ORDER by end_time ASC limit 0,10 '; $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 '];  if (Strstr ($row [' Ad_code '], "http")) {$arr [$idx] [' imgcode ']     = $row [' Ad_code '];} else{        $arr [$idx] [' imgcode ']     = "/data/afficheimg/". $row [' Ad_code '];}    }    return $arr;}

Open the root directory of the index.php, of course, this is we are to call the ad bit on the homepage, if you want to call the ad bit on the other page then open the corresponding page on the line.
$smarty->assign (' Top_goods ', GET_TOP10 ()) in the index.php, followed by:
$smarty->assign (' Ad_diy ', Index_ad_diy (53));
The 53 here is the ad ID number, can be viewed through the site management in the background of the ad bit.

Finally we open the INDEX.DWT template page and use it where we need to call to change the ad bit:

<!--{foreach from= $ad _diyitem=diyad}--><dd><a title= "{$diyAd. title|escape:html}" href= "{$ Diyad.imglink} "Target=_blank></A></dd> <!--{/foreach}-->

That's it!

The custom call advertisement method of Ecshop Mall website Construction (II.)

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: 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.