ECSHOP 首页主广告管理 Flash替换成其他js效果的修改
2015-12-11 15:34
736 查看
把这个函数插入到index.php中最下面即可,
function get_index_ad(){
$sql = 'SELECT ad_type, content,ad_name,url FROM ' . $GLOBALS['ecs']->table("ad_custom") ;
$res = $GLOBALS['db']->getAll($sql);
$ads = array();
foreach ($res AS $adx => $row)
{
$ads[$adx]['ad_type'] = $row['ad_type'];
$ads[$adx]['content'] = $row['content'];
$ads[$adx]['url'] = $row['url'];
$ads[$adx]['ad_name'] = $row['ad_name'];
}
return $ads;
}
然后在
那一堆smarty中定义一个标签即可(不过到时候后台添加图片是在首页主广告那里自定义添加)
$smarty->assign('index_adlist', get_index_ad());
然后在DWT文件中引用即可
如:<!--{foreach from=$index_adlist item=ads}-->
<li><a target="_blank" href="{$ads.url}"><img src="{$ads.content}" alt="{$ads.ad_name}"></a></li>
<!--{/foreach}-->
循环来自标签'index_adlist' 其中url为图片链接地址 content为图片 ad_name为图片名称
function get_index_ad(){
$sql = 'SELECT ad_type, content,ad_name,url FROM ' . $GLOBALS['ecs']->table("ad_custom") ;
$res = $GLOBALS['db']->getAll($sql);
$ads = array();
foreach ($res AS $adx => $row)
{
$ads[$adx]['ad_type'] = $row['ad_type'];
$ads[$adx]['content'] = $row['content'];
$ads[$adx]['url'] = $row['url'];
$ads[$adx]['ad_name'] = $row['ad_name'];
}
return $ads;
}
然后在
那一堆smarty中定义一个标签即可(不过到时候后台添加图片是在首页主广告那里自定义添加)
$smarty->assign('index_adlist', get_index_ad());
然后在DWT文件中引用即可
如:<!--{foreach from=$index_adlist item=ads}-->
<li><a target="_blank" href="{$ads.url}"><img src="{$ads.content}" alt="{$ads.ad_name}"></a></li>
<!--{/foreach}-->
循环来自标签'index_adlist' 其中url为图片链接地址 content为图片 ad_name为图片名称
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- PHP+Apache在Windows 9x下的安装和配置
- IIS 6 的 PHP 最佳配置方法
- 安装Apache和PHP的一些补充
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站
- PHP 5.3.0 安装分析心得
- apache 环境下 php 的配置注意事项
- ASP.NET、ASP、PHP、JSP之间有什么区别?
- PHP VBS JS 函数 对照表
- C语言实现的统计php代码行数功能源码(支持文件夹、多目录)
- php xml 入门学习资料