function list_category($category, $prefix = NULL)
{
    if ($category) {
        assign('prefix', $prefix);
        assign('category', $category);
        Template('blocks/category.html');
        if ($category['children']) {
            $prefix = $prefix . ' –	 ';
            foreach ($category['children'] as $child) {
                list_category($child, $prefix);
            }
        }
    }
}
Exemple #2
0
    <?
        $iblok_id = '2';
        $category =  $_SERVER['REQUEST_URI'];
        $category = explode("?", $category);
        $category = explode("/", $category[0]);
    ?>
    <?
        $array_empty = array('');
        $cat = array();
        $category = array_diff($category, $array_empty);
        foreach($category as $item):
            array_push($cat ,$item);
        endforeach;
    ?>
 <?
        $arr = list_category($cat[count($cat)-1]);
        /*Получаем значение где(в городе /за городом)*/
        $params = $cat[count($cat)-2];
        $city = $params;
        $property_enums = CIBlockPropertyEnum::GetList(Array("DEF"=>"DESC", "SORT"=>"ASC"), Array("IBLOCK_ID"=>2, "XML_ID"=>$params));
        if($enum_fields = $property_enums->GetNext())
        
        global $arrFilter;
        //echo $params;
        $arrFilter = Array(
        /*"!=ID"=>$arResult['ID'],*/
        "PROPERTY_category"=>$arr[0]['ID'],
        "PROPERTY_params_VALUE" => $enum_fields['~VALUE'],
        //">=DATE_ACTIVE_TO" => "17.04.2015",
        );
        if($arr[0]['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE']!='')      
Exemple #3
0
    case "edit":
        show_edit_category_form($config, $_GET['id']);
        break;
    case "submit_edit":
        $isSuccess = submit_edit_category($config);
        if ($isSuccess) {
            echo "<p>1 category is updated</p>";
        } else {
            echo "<p>CAN NOT update category</p>";
        }
        list_category($config);
        show_add_category_form();
        break;
    case "delete":
        confirmDeleteCategory($config);
        break;
    case "submit_delete":
        $isSuccess = submit_delete_category($config);
        if ($isSuccess) {
            echo "<p>1 category is deleted</p>";
        } else {
            echo "<p>CAN NOT delete category</p>";
        }
        list_category($config);
        show_add_category_form();
        break;
}
?>

</body>
</html>
<?php

include_once 'config.php';
include_once 'func.php';
$connection = connect_db();
$result = get_category($connection);
?>

<!DOCTYPE HTML>
<html>
<head>
    <title>List Category</title>
</head>
<body>
    <a href="index.php">Go Home</a></br></br> 
    <?php 
list_category($result);
release_data($result);
?>
</body>
</html>
<?php 
close_db($connection);