zoukankan      html  css  js  c++  java
  • zencart 自定义函数

    -----------------------------------------------------------------------------------------------------------

    ---------------------------------列出目录 网址--------------------------------------------------------

    -----------------------------------------------------------------------------------------------------------

    function zen_get_categories_names($categories_array = '', $parent_id = '0', $indent = '') {
    global $db;

    if (!is_array($categories_array)) $categories_array = array();

    $categories_query = "select c.categories_id, cd.categories_name
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
    where parent_id = '" . (int)$parent_id . "'
    and c.categories_id = cd.categories_id
    and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    order by sort_order, cd.categories_name";

    $categories = $db->Execute($categories_query);

    while (!$categories->EOF) {
    $categories_array[] = array(zen_href_link(FILENAME_DEFAULT, 'cPath=' . $categories->fields['categories_id']),
    $categories->fields['categories_name']);

    if ($categories->fields['categories_id'] != $parent_id) {
    $categories_array = zen_get_categories_names($categories_array, $categories->fields['categories_id'],'');
    }
    $categories->MoveNext();
    }
    return $categories_array;
    }
    ?>

    ----------------------

    <?php
    foreach (zen_get_categories_names(array(array()),0 ,'') as $key => $value)
    {
    if (is_array($value))
    {
    print_r($value);
    }
    }

    ----------------------输出:

    Array ( [0] => http://localhost/3/zencart151zh001/index.php?main_page=index&cPath=1 [1] => Jacke Damen ~ cafe racer damen ) Array ( [0] => http://localhost/3/zencart151zh001/index.php?main_page=index&cPath=2 [1] => Jacke Herren ~ outlet jacke )

    ------------------------------------------------------------------------------------------------

  • 相关阅读:
    poj2976 Dropping tests (01分数规划)
    bzoj5281/luogu4377 Talent Show (01分数规划+背包dp)
    bzoj5280/luogu4376 MilkingOrder (二分答案+拓扑序)
    bzoj1492/luogu4027 货币兑换 (斜率优化+cdq分治)
    [模板]树状数组
    匿名函数 python
    yield解析你要知道的源自IBM
    stackoverflow yield 帖子
    pandas 生成器,生成大数据
    pd.contact,dataframe 拼接
  • 原文地址:https://www.cnblogs.com/alex-13/p/4386182.html
Copyright © 2011-2022 走看看