Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p>
- $view = new view; $view->name = 'Catalog_page'; $view->description = ''; $view->tag = ''; $view->view_php = ''; $view->base_table = 'node'; $view->is_cacheable = FALSE; $view->api_version = 2; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->override_option('access', array( 'type' => 'none', )); $handler->override_option('cache', array( 'type' => 'none', )); $handler->override_option('title', 'Каталог'); $handler->override_option('use_pager', 'mini'); $handler->override_option('row_plugin', 'node'); $handler->override_option('row_options', array( 'relationship' => 'none', 'build_mode' => 'teaser', 'links' => 1, 'comments' => 0, )); $handler = $view->new_display('page', 'Страница каталога', 'page_1'); $handler->override_option('arguments', array( 'term_node_tid_depth' => array( 'default_action' => 'ignore', 'style_plugin' => 'default_summary', 'style_options' => array(), 'wildcard' => 'all', 'wildcard_substitution' => 'Все', 'title' => '%1', 'breadcrumb' => 'Каталог', 'default_argument_type' => 'fixed', 'default_argument' => '', 'validate_type' => 'taxonomy_term', 'validate_fail' => 'not found', 'depth' => '2', 'break_phrase' => 0, 'set_breadcrumb' => 1, 'use_taxonomy_term_path' => 0, 'id' => 'term_node_tid_depth', 'table' => 'node', 'field' => 'term_node_tid_depth', 'validate_user_argument_type' => 'uid', 'validate_user_roles' => array( '2' => 0, ), 'override' => array( 'button' => 'Use default', ), 'relationship' => 'none', 'default_options_div_prefix' => '', 'default_argument_fixed' => '', 'default_argument_user' => 0, 'default_argument_php' => '', 'validate_argument_node_type' => array( 'art' => 0, 'children' => 0, 'eda' => 0, 'hotel' => 0, 'nightlife' => 0, 'sauna' => 0, 'sport' => 0, 'transport' => 0, ), 'validate_argument_node_access' => 0, 'validate_argument_nid_type' => 'nid', 'validate_argument_vocabulary' => array( '15' => 15, '16' => 0, '1' => 0, '2' => 0, '14' => 0, '12' => 0, '8' => 0, '6' => 0, '5' => 0, '13' => 0, '7' => 0, '9' => 0, '4' => 0, '11' => 0, '10' => 0, ), 'validate_argument_type' => 'tid', 'validate_argument_transform' => 0, 'validate_user_restrict_roles' => 0, 'validate_argument_php' => '', ), )); $handler->override_option('header', '<?php
- $vid = 15; // id словаря
- $arg_pos = 1; // номер позиции аргумента, в нашем случает 1
- $cols = 3; // кол-во столбцов для отображения
- $show_count = TRUE; // показывать или нет кол-во нод в терминах.
- if (is_numeric(arg($arg_pos))) {
- $tid = arg($arg_pos);
- $terms = taxonomy_get_children($tid, $vid);
- if (!empty($terms)) {
- $output = \'<table class="catalog-page">\';
- $count = 0;
- $total = count($terms);
- foreach ($terms as $tid => $term) {
- if ($count % $cols == 0) {
- $output .= \'<tr>\';
- }
- $item = l($term->name, taxonomy_term_path($term));
- if ($show_count) {
- $count_nodes = taxonomy_term_count_nodes($term->tid);
- $item .= ($count_nodes) ? " ($count_nodes)" : " (0)";
- }
- $count++;
- $output .= \'<td>\'. $item .\'</td>\';
- if ($count % $cols == 0 || $count == $total) {
- $output .= \'</tr>\';
- }
- }
- $output .= \'</table>\';
- return $output;
- }
- }
- ?>'); $handler->override_option('header_format', '3'); $handler->override_option('header_empty', 0); $handler->override_option('path', 'catalog/%'); $handler->override_option('menu', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler = $view->new_display('page', 'Корень каталога', 'page_2'); $handler->override_option('arguments', array( 'null' => array( 'default_action' => 'empty', 'style_plugin' => 'default_summary', 'style_options' => array(), 'wildcard' => 'all', 'wildcard_substitution' => 'Все', 'title' => '', 'breadcrumb' => '', 'default_argument_type' => 'fixed', 'default_argument' => '', 'validate_type' => 'none', 'validate_fail' => 'not found', 'must_not_be' => 0, 'id' => 'null', 'table' => 'views', 'field' => 'null', 'validate_user_argument_type' => 'uid', 'validate_user_roles' => array( '2' => 0, ), 'override' => array( 'button' => 'Use default', ), 'relationship' => 'none', 'default_options_div_prefix' => '', 'default_argument_fixed' => '', 'default_argument_user' => 0, 'default_argument_php' => '', 'validate_argument_node_type' => array( 'art' => 0, 'children' => 0, 'eda' => 0, 'hotel' => 0, 'nightlife' => 0, 'sauna' => 0, 'sport' => 0, 'transport' => 0, ), 'validate_argument_node_access' => 0, 'validate_argument_nid_type' => 'nid', 'validate_argument_vocabulary' => array( '15' => 0, '16' => 0, '1' => 0, '2' => 0, '14' => 0, '12' => 0, '8' => 0, '6' => 0, '5' => 0, '13' => 0, '7' => 0, '9' => 0, '4' => 0, '11' => 0, '10' => 0, ), 'validate_argument_type' => 'tid', 'validate_argument_transform' => 0, 'validate_user_restrict_roles' => 0, 'validate_argument_php' => '', ), 'null_1' => array( 'default_action' => 'default', 'style_plugin' => 'default_summary', 'style_options' => array(), 'wildcard' => 'all', 'wildcard_substitution' => 'Все', 'title' => '', 'breadcrumb' => '', 'default_argument_type' => 'fixed', 'default_argument' => '', 'validate_type' => 'none', 'validate_fail' => 'not found', 'must_not_be' => 0, 'id' => 'null_1', 'table' => 'views', 'field' => 'null', 'validate_user_argument_type' => 'uid', 'validate_user_roles' => array( '2' => 0, ), 'override' => array( 'button' => 'Use default', ), 'relationship' => 'none', 'default_options_div_prefix' => '', 'default_argument_fixed' => '', 'default_argument_user' => 0, 'default_argument_php' => '', 'validate_argument_node_type' => array( 'art' => 0, 'children' => 0, 'eda' => 0, 'hotel' => 0, 'nightlife' => 0, 'sauna' => 0, 'sport' => 0, 'transport' => 0, ), 'validate_argument_node_access' => 0, 'validate_argument_nid_type' => 'nid', 'validate_argument_vocabulary' => array( '15' => 0, '16' => 0, '1' => 0, '2' => 0, '14' => 0, '12' => 0, '8' => 0, '6' => 0, '5' => 0, '13' => 0, '7' => 0, '9' => 0, '4' => 0, '11' => 0, '10' => 0, ), 'validate_argument_type' => 'tid', 'validate_argument_transform' => 0, 'validate_user_restrict_roles' => 0, 'validate_argument_php' => '', ), )); $handler->override_option('empty', '<?php
- $vid = 15; // id словаря
- $cols = 3; // кол-во столбцов для отображения
- $limit = 3; // кол-во выводимых дочерных терминов
- $tree = taxonomy_get_tree($vid, 0, -1, 1);
- if (!empty($tree)) {
- $output = \'<table class="catalog-root">\';
- $count = 0;
- $total = count($tree);
- foreach ($tree as $tid => $term) {
- if ($count % $cols == 0) {
- $output .= \'<tr>\';
- }
- $item = \'<h2>\'. l($term->name, taxonomy_term_path($term)) .\'</h2>\';
- $children_list = array();
- $children = taxonomy_get_children($term->tid, $vid);
- $i = 1;
- foreach (taxonomy_get_children($term->tid, $vid) as $child) {
- $children_list[] = l($child->name, taxonomy_term_path($child));
- if ($limit != 0 && $i >= $limit) break;
- $i++;
- }
- if (count($children) > $limit) {
- $children_list[] = l(\'...\', taxonomy_term_path($term));
- }
- $count++;
- $item .= implode(\' / \', $children_list);
- $output .= \'<td>\'. $item .\'</td>\';
- if ($count % $cols == 0 || $count == $total) {
- $output .= \'</tr>\';
- }
- }
- $output .= \'</table>\';
- return $output;
- }
- ?>'); $handler->override_option('empty_format', '3'); $handler->override_option('path', 'catalog/all'); $handler->override_option('menu', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', ));</p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement