/** * 取得当前位置和页面标题 * * @access public * @param integer $cat 分类编号(只有商品及分类、文章及分类用到) * @param string $str 商品名、文章标题或其他附加的内容(无链接) * @return array */ function assign_ur_here($cat = 0, $str = '') { /* 判断是否重写,取得文件名 */ $cur_url = basename(PHP_SELF); if (intval($GLOBALS['_CFG']['rewrite'])) { $filename = strpos($cur_url, '-') ? substr($cur_url, 0, strpos($cur_url, '-')) : substr($cur_url, 0, -4); } else { $filename = substr($cur_url, 0, -4); } /* 初始化“页面标题”和“当前位置” */ $page_title = $GLOBALS['_CFG']['shop_title']; $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>'; /* 根据文件名分别处理中间的部分 */ if ($filename != 'index') { /* 处理有分类的 */ if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) { /* 商品分类或商品 */ if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) { if ($cat > 0) { $cat_arr = get_parent_cats($cat); $key = 'cid'; $type = 'category'; } else { $cat_arr = array(); } } elseif ('article_cat' == $filename || 'article' == $filename) { if ($cat > 0) { $cat_arr = get_article_parent_cats($cat); $key = 'acid'; $type = 'article_cat'; } else { $cat_arr = array(); } } /* 循环分类 */ if (!empty($cat_arr)) { krsort($cat_arr); foreach ($cat_arr as $val) { $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title; $args = array($key => $val['cat_id']); $ur_here .= ' <code>></code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . htmlspecialchars($val['cat_name']) . '</a>'; } } } else { /* 团购 */ if ('group_buy' == $filename) { $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title; $args = array('gbid' => '0'); $ur_here .= ' <code>></code> <a href="group_buy.php">' . $GLOBALS['_LANG']['group_buy_goods'] . '</a>'; } elseif ('auction' == $filename) { $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title; $args = array('auid' => '0'); $ur_here .= ' <code>></code> <a href="auction.php">' . $GLOBALS['_LANG']['auction'] . '</a>'; } elseif ('snatch' == $filename) { $page_title = $GLOBALS['_LANG']['snatch'] . '_' . $page_title; $args = array('id' => '0'); $ur_here .= ' <code> > </code><a href="snatch.php">' . $GLOBALS['_LANG']['snatch_list'] . '</a>'; } elseif ('wholesale' == $filename) { $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>></code> <a href="wholesale.php">' . $GLOBALS['_LANG']['wholesale'] . '</a>'; } elseif ('exchange' == $filename) { $page_title = $GLOBALS['_LANG']['exchange'] . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>></code> <a href="exchange.php">' . $GLOBALS['_LANG']['exchange'] . '</a>'; } /* 其他的在这里补充 */ } } /* 处理最后一部分 */ if (!empty($str)) { $page_title = $str . '_' . $page_title; $ur_here .= ' <code>></code> ' . $str; } /* 返回值 */ return array('title' => $page_title, 'ur_here' => $ur_here); }
// 特价商品 $smarty->assign('id', $article_id); $smarty->assign('username', $_SESSION['user_name']); $smarty->assign('email', $_SESSION['email']); $smarty->assign('type', '1'); $smarty->assign('promotion_info', get_promotion_info()); /* 验证码相关设置 */ if (intval($_CFG['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) { $smarty->assign('enabled_captcha', 1); $smarty->assign('rand', mt_rand()); } $smarty->assign('article', $article); $smarty->assign('keywords', htmlspecialchars($article['keywords'])); $smarty->assign('description', htmlspecialchars($article['description'])); $catlist = array(); foreach (get_article_parent_cats($article['cat_id']) as $k => $v) { $catlist[] = $v['cat_id']; } assign_template('a', $catlist); $position = assign_ur_here($article['cat_id'], $article['title']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('comment_type', 1); if ($type == 'sjs') { $table = 'ecs_article_sjs'; } else { if ($type == 'jg') { $table = 'ecs_article_jg'; } else {
/** * 取得当前位置和页面标题 * * @access public * @param integer $cat 分类编号(只有商品及分类、文章及分类用到) * @param string $str 商品名、文章标题或其他附加的内容(无链接) * @return array */ function assign_ur_here($cat = 0, $str = '') { /* 判断是否重写,取得文件名 */ $touch =& get_instance(); $filename = $touch->router->fetch_class(); /* 初始化“页面标题”和“当前位置” */ $page_title = C('shop_title') . ' - ' . 'Powered by ECTouch'; $ur_here = '<a href=".">' . L('home') . '</a>'; /* 根据文件名分别处理中间的部分 */ if ($filename != 'index') { /* 处理有分类的 */ if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) { /* 商品分类或商品 */ if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) { if ($cat > 0) { $cat_arr = get_parent_cats($cat); $key = 'cid'; $type = 'category'; } else { $cat_arr = array(); } } elseif ('article_cat' == $filename || 'article' == $filename) { if ($cat > 0) { $cat_arr = get_article_parent_cats($cat); $key = 'acid'; $type = 'article_cat'; } else { $cat_arr = array(); } } /* 循环分类 */ if (!empty($cat_arr)) { krsort($cat_arr); foreach ($cat_arr as $val) { $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title; $args = array($key => $val['cat_id']); $ur_here .= ' <code>></code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . htmlspecialchars($val['cat_name']) . '</a>'; } } } else { /* 团购 */ if ('group_buy' == $filename) { $page_title = L('group_buy_goods') . '_' . $page_title; $args = array('gbid' => '0'); $ur_here .= ' <code>></code> <a href="group_buy.php">' . L('group_buy_goods') . '</a>'; } elseif ('auction' == $filename) { $page_title = L('auction') . '_' . $page_title; $args = array('auid' => '0'); $ur_here .= ' <code>></code> <a href="auction.php">' . L('auction') . '</a>'; } elseif ('snatch' == $filename) { $page_title = L('snatch') . '_' . $page_title; $args = array('id' => '0'); $ur_here .= ' <code> > </code><a href="snatch.php">' . L('snatch_list') . '</a>'; } elseif ('wholesale' == $filename) { $page_title = L('wholesale') . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>></code> <a href="wholesale.php">' . L('wholesale') . '</a>'; } elseif ('exchange' == $filename) { $page_title = L('exchange') . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>></code> <a href="exchange.php">' . L('exchange') . '</a>'; } /* 其他的在这里补充 */ } } /* 处理最后一部分 */ if (!empty($str)) { $page_title = $str . '_' . $page_title; $ur_here .= ' <code>></code> ' . $str; } /* 返回值 */ return array('title' => $page_title, 'ur_here' => $ur_here); }