Ecshop网站信息中一般是“公司简介”“联系我们”之类的内容,要是把这些文章删除,在添加新的文章就不会显示。
调用代码如下:
<div class="block cl">
<!-- {foreach name=nav_bottom_list from=$navigator_list.bottom item=nav} -->
<a href="{$nav.url}" <!-- {if $nav.opennew eq 1} --> target="_blank" <!-- {/if} -->>{$nav.name}</a>
<!-- {if !$smarty.foreach.nav_bottom_list.last} -->
|
<!-- {/if} -->
<!-- {/foreach} --><br />
</div>
$navigator_list变量来自于 includes/lib_main.php
get_navigator() 函数
以下是代码:
/**
* 取得自定义导航栏列表
* @param string $type 位置,如top、bottom、middle
* @return array 列表
*/
function get_navigator($ctype = '', $catlist = array())
{
$sql = 'SELECT * FROM '. $GLOBALS['ecs']->table('nav') . '
WHERE ifshow = \'1\' ORDER BY type, vieworder';
$res = $GLOBALS['db']->query($sql);
$cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1);
if (intval($GLOBALS['_CFG']['rewrite']))
{
if(strpos($cur_url, '-'))
{
preg_match('/([a-z]*)-([0-9]*)/',$cur_url,$matches);
$cur_url = $matches[1].'.php?id='.$matches[2];
}
}
else
{
$cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1);
}
$noindex = false;
$active = 0;
$navlist = array(
'top' => array(),
'middle' => array(),
'bottom' => array()
);
while ($row = $GLOBALS['db']->fetchRow($res))
{
$navlist[$row['type']][] = array(
'name' => $row['name'],
'opennew' => $row['opennew'],
'url' => $row['url'],
'ctype' => $row['ctype'],
'cid' => $row['cid'],
);
}
/*遍历自定义是否存在currentPage*/
foreach($navlist['middle'] as $k=>$v)
{
$condition = empty($ctype) ? (strpos($cur_url, $v['url']) === 0) : (strpos($cur_url, $v['url']) === 0 && strlen($cur_url) == strlen($v['url']));
if ($condition)
{
$navlist['middle'][$k]['active'] = 1;
$noindex = true;
$active += 1;
}
}
if(!empty($ctype) && $active < 1)
{
foreach($catlist as $key => $val)
{
foreach($navlist['middle'] as $k=>$v)
{
if(!empty($v['ctype']) && $v['ctype'] == $ctype && $v['cid'] == $val && $active < 1)
{
$navlist['middle'][$k]['active'] = 1;
$noindex = true;
$active += 1;
}
}
}
}
if ($noindex == false) {
$navlist['config']['index'] = 1;
}
return $navlist;
}
其实这些文章是在“网站导航”中进行设置的。
- 上一篇:北京Ecshop二次开发
- 下一篇:Ecshop paypal支付开发