• 欢迎浏览“String me = Creater\忠实的资深Linux玩家;”,请文明浏览,理性发言,有侵犯你的权益请邮件我(creater@vip.qq.com).
  • 把任何的失败都当作一次尝试,不要自卑;把所有的成功都想成是一种幸运,不要自傲。
  •    2年前 (2016-05-14)  Eigen php |   抢沙发  31 
    文章评分 0 次,平均分 0.0

    1.拷贝mobille/admin下的ads.php,ad_position.php,重命名为ads_mobile.php,ad_position.php到admin目录下;
    2.修改上两个文件内的所有链接ads.php,ad_position.php为ads_mobile.php,ad_position.php;
    3.修改templates下的ad_position_info.htm,ad_position_list.htm,ads_info.htm,ads_js.htm,ads_list.htm,adsense.htm其中的所有ads.php,ad_position.php为ads_mobile.php,ad_position.php(记得先备份这几个文件);
    4.在admin/includes/inc_menu.php里修改ads.php,ad_position.php为ads_mobile.php,ad_position.php;
    5.在后台便可见了,上传的图片放在了data/afficheimg里面,但是mobile端商城还是显示的是mobile/data/afficheimg里的图片,因此接下来修改mobile端的程序。
    6.修改mobile/index.php里的代码为

    function get_wap_advlist( $position, $num )
    {
    		$arr = array( );
    		$sql = "select ap.ad_width,ap.ad_height,ad.ad_id,ad.ad_name,ad.ad_code,ad.ad_link,ad.ad_id from ".$GLOBALS['ecs']->table( "ecsmart_ad_position" )." as ap left join ".$GLOBALS['ecs']->table( "ecsmart_ad" )." as ad on ad.position_id = ap.position_id where ap.position_name='".$position.( "' and UNIX_TIMESTAMP()>ad.start_time and UNIX_TIMESTAMP()<ad.end_time and ad.enabled=1 limit ".$num );
    		$res = $GLOBALS['db']->getAll( $sql );
    		foreach ( $res as $idx => $row )
    		{
    				$arr[$row['ad_id']]['name'] = $row['ad_name'];
    				$arr[$row['ad_id']]['url'] = "affiche.php?ad_id=".$row['ad_id']."&uri=".$row['ad_link'];
    				$arr[$row['ad_id']]['image'] = "../data/afficheimg/".$row['ad_code'];
    				$arr[$row['ad_id']]['content'] = "<a href='".$arr[$row['ad_id']]['url']."' target='_blank'><img src='../data/afficheimg/".$row['ad_code']."' width='".$row['ad_width']."' height='".$row['ad_height']."' /></a>";
    				$arr[$row['ad_id']]['ad_code'] = $row['ad_code'];
    		}
    		return $arr;
    }

    这样首页的幻灯片就显示data/afficheimg里的图片里,但是下面广告还是显示mobile/data/afficheimg里的图片
    7.修改mobile/includes/lib_insert.php里的代码为,大约在295行

     switch ($row['media_type'])
            {
                case 0: // 图片广告
                    $src = (strpos($row['ad_code'], 'http://') === false && strpos($row['ad_code'], 'https://') === false) ?
                            DATA_DIR . "/../../data"."/afficheimg/$row[ad_code]" : $row['ad_code'];
                    $ads[] = "<a href='affiche.php?ad_id=$row[ad_id]&amp;uri=" .urlencode($row["ad_link"]). "'
                    target='_blank'><img src='$src' width='" .$row['ad_width']. "' height='$row[ad_height]'
                    border='0' /></a>";
                    break;
                case 1: // Flash
                    $src = (strpos($row['ad_code'], 'http://') === false && strpos($row['ad_code'], 'https://') === false) ?
                            DATA_DIR . "/../../data"."/afficheimg/$row[ad_code]" : $row['ad_code'];
                    $ads[] = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" " .
                             "codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\"  " .
                               "width='$row[ad_width]' height='$row[ad_height]'>
                               <param name='movie' value='$src'>
                               <param name='quality' value='high'>
                               <embed src='$src' quality='high'
                               pluginspage='http://www.macromedia.com/go/getflashplayer'
                               type='application/x-shockwave-flash' width='$row[ad_width]'
                               height='$row[ad_height]'></embed>
                             </object>";
                    break;
                case 2: // CODE
                    $ads[] = $row['ad_code'];
                    break;
                case 3: // TEXT
                    $ads[] = "<a href='affiche.php?ad_id=$row[ad_id]&amp;uri=" .urlencode($row["ad_link"]). "'
                    target='_blank'>" .htmlspecialchars($row['ad_code']). '</a>';
                    break;
            }

    8.修改商品目录里图片的路径,文件为mobile/catalog.php

    /*分类调用id广告*/
    function get_advlist( $position, $num )
    {
    		$arr = array( );
    		$sql = "select ap.ad_width,ap.ad_height,ad.ad_id,ad.ad_name,ad.ad_code,ad.ad_link,ad.ad_id from ".$GLOBALS['ecs']->table( "ecsmart_ad_position" )." as ap left join ".$GLOBALS['ecs']->table( "ecsmart_ad" )." as ad on ad.position_id = ap.position_id where ap.position_name='".$position.( "' and UNIX_TIMESTAMP()>ad.start_time and UNIX_TIMESTAMP()<ad.end_time and ad.enabled=1 limit ".$num );
    		$res = $GLOBALS['db']->getAll( $sql );
    		foreach ( $res as $idx => $row )
    		{
    				$arr[$row['ad_id']]['name'] = $row['ad_name'];
    				$arr[$row['ad_id']]['url'] = "affiche.php?ad_id=".$row['ad_id']."&uri=".$row['ad_link'];
    				$arr[$row['ad_id']]['image'] = "../data/afficheimg/".$row['ad_code'];
    				$arr[$row['ad_id']]['content'] = "<a href='".$arr[$row['ad_id']]['url']."' target='_blank'><img src='../data/afficheimg/".$row['ad_code']."' width='".$row['ad_width']."' height='".$row['ad_height']."' /></a>";
    				$arr[$row['ad_id']]['ad_code'] = $row['ad_code'];
    		}
    		return $arr;
    }
     

    除特别注明外,本站所有文章均为String me = "Creater\忠实的资深Linux玩家";原创,转载请注明出处来自http://unix8.net/home.php/4887.html

    关于

    发表评论

    暂无评论

    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    扫一扫二维码分享