• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_article_parent_cats函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_article_parent_cats函数的典型用法代码示例。如果您正苦于以下问题:PHP get_article_parent_cats函数的具体用法?PHP get_article_parent_cats怎么用?PHP get_article_parent_cats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_article_parent_cats函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: assign_ur_here

/**
 * 取得当前位置和页面标题
 *
 * @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>&gt;</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>&gt;</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>&gt;</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> &gt; </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>&gt;</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>&gt;</code> <a href="exchange.php">' . $GLOBALS['_LANG']['exchange'] . '</a>';
            }
            /* 其他的在这里补充 */
        }
    }
    /* 处理最后一部分 */
    if (!empty($str)) {
        $page_title = $str . '_' . $page_title;
        $ur_here .= ' <code>&gt;</code> ' . $str;
    }
    /* 返回值 */
    return array('title' => $page_title, 'ur_here' => $ur_here);
}
开发者ID:YangZeSummer,项目名称:NanJingSecond-Hand,代码行数:85,代码来源:lib_main.php


示例2: get_promotion_info

 // 特价商品
 $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 {
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:article.php


示例3: assign_ur_here

/**
 * 取得当前位置和页面标题
 *
 * @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>&gt;</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>&gt;</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>&gt;</code> <a href="auction.php">' . L('auction') . '</a>';
            } elseif ('snatch' == $filename) {
                $page_title = L('snatch') . '_' . $page_title;
                $args = array('id' => '0');
                $ur_here .= ' <code> &gt; </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>&gt;</code> <a href="wholesale.php">' . L('wholesale') . '</a>';
            } elseif ('exchange' == $filename) {
                $page_title = L('exchange') . '_' . $page_title;
                $args = array('wsid' => '0');
                $ur_here .= ' <code>&gt;</code> <a href="exchange.php">' . L('exchange') . '</a>';
            }
            /* 其他的在这里补充 */
        }
    }
    /* 处理最后一部分 */
    if (!empty($str)) {
        $page_title = $str . '_' . $page_title;
        $ur_here .= ' <code>&gt;</code> ' . $str;
    }
    /* 返回值 */
    return array('title' => $page_title, 'ur_here' => $ur_here);
}
开发者ID:connwap135,项目名称:ectouch,代码行数:81,代码来源:main_helper.php



注:本文中的get_article_parent_cats函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_article_tags函数代码示例发布时间:2022-05-15
下一篇:
PHP get_article_list函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap