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 )

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

  • 相关阅读:
    VScode 最新eslint设置
    vue部署在二级目录
    实现网页比12像素小
    css一个很好用的hover显示
    VSCode设置
    vue发布后的一些问题
    设置cssrem,设置emmet
    js时间与时间戳之间的转换操作,返回天、小时、分,全家桶
    Error resolving template [xxx], template might not exist or might not be exist
    解决jenkins shell执行sonar-scanner提示命令存在的问题
  • 原文地址:https://www.cnblogs.com/alex-13/p/4386182.html
Copyright © 2011-2022 走看看