SHARE
TWEET

Untitled

a guest Nov 12th, 2010 482 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <p>
  2.         $view = new view; $view-&gt;name = &#39;Catalog_page&#39;; $view-&gt;description = &#39;&#39;; $view-&gt;tag = &#39;&#39;; $view-&gt;view_php = &#39;&#39;; $view-&gt;base_table = &#39;node&#39;; $view-&gt;is_cacheable = FALSE; $view-&gt;api_version = 2; $view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */ $handler = $view-&gt;new_display(&#39;default&#39;, &#39;Defaults&#39;, &#39;default&#39;); $handler-&gt;override_option(&#39;access&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, )); $handler-&gt;override_option(&#39;cache&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, )); $handler-&gt;override_option(&#39;title&#39;, &#39;Каталог&#39;); $handler-&gt;override_option(&#39;use_pager&#39;, &#39;mini&#39;); $handler-&gt;override_option(&#39;row_plugin&#39;, &#39;node&#39;); $handler-&gt;override_option(&#39;row_options&#39;, array( &#39;relationship&#39; =&gt; &#39;none&#39;, &#39;build_mode&#39; =&gt; &#39;teaser&#39;, &#39;links&#39; =&gt; 1, &#39;comments&#39; =&gt; 0, )); $handler = $view-&gt;new_display(&#39;page&#39;, &#39;Страница каталога&#39;, &#39;page_1&#39;); $handler-&gt;override_option(&#39;arguments&#39;, array( &#39;term_node_tid_depth&#39; =&gt; array( &#39;default_action&#39; =&gt; &#39;ignore&#39;, &#39;style_plugin&#39; =&gt; &#39;default_summary&#39;, &#39;style_options&#39; =&gt; array(), &#39;wildcard&#39; =&gt; &#39;all&#39;, &#39;wildcard_substitution&#39; =&gt; &#39;Все&#39;, &#39;title&#39; =&gt; &#39;%1&#39;, &#39;breadcrumb&#39; =&gt; &#39;Каталог&#39;, &#39;default_argument_type&#39; =&gt; &#39;fixed&#39;, &#39;default_argument&#39; =&gt; &#39;&#39;, &#39;validate_type&#39; =&gt; &#39;taxonomy_term&#39;, &#39;validate_fail&#39; =&gt; &#39;not found&#39;, &#39;depth&#39; =&gt; &#39;2&#39;, &#39;break_phrase&#39; =&gt; 0, &#39;set_breadcrumb&#39; =&gt; 1, &#39;use_taxonomy_term_path&#39; =&gt; 0, &#39;id&#39; =&gt; &#39;term_node_tid_depth&#39;, &#39;table&#39; =&gt; &#39;node&#39;, &#39;field&#39; =&gt; &#39;term_node_tid_depth&#39;, &#39;validate_user_argument_type&#39; =&gt; &#39;uid&#39;, &#39;validate_user_roles&#39; =&gt; array( &#39;2&#39; =&gt; 0, ), &#39;override&#39; =&gt; array( &#39;button&#39; =&gt; &#39;Use default&#39;, ), &#39;relationship&#39; =&gt; &#39;none&#39;, &#39;default_options_div_prefix&#39; =&gt; &#39;&#39;, &#39;default_argument_fixed&#39; =&gt; &#39;&#39;, &#39;default_argument_user&#39; =&gt; 0, &#39;default_argument_php&#39; =&gt; &#39;&#39;, &#39;validate_argument_node_type&#39; =&gt; array( &#39;art&#39; =&gt; 0, &#39;children&#39; =&gt; 0, &#39;eda&#39; =&gt; 0, &#39;hotel&#39; =&gt; 0, &#39;nightlife&#39; =&gt; 0, &#39;sauna&#39; =&gt; 0, &#39;sport&#39; =&gt; 0, &#39;transport&#39; =&gt; 0, ), &#39;validate_argument_node_access&#39; =&gt; 0, &#39;validate_argument_nid_type&#39; =&gt; &#39;nid&#39;, &#39;validate_argument_vocabulary&#39; =&gt; array( &#39;15&#39; =&gt; 15, &#39;16&#39; =&gt; 0, &#39;1&#39; =&gt; 0, &#39;2&#39; =&gt; 0, &#39;14&#39; =&gt; 0, &#39;12&#39; =&gt; 0, &#39;8&#39; =&gt; 0, &#39;6&#39; =&gt; 0, &#39;5&#39; =&gt; 0, &#39;13&#39; =&gt; 0, &#39;7&#39; =&gt; 0, &#39;9&#39; =&gt; 0, &#39;4&#39; =&gt; 0, &#39;11&#39; =&gt; 0, &#39;10&#39; =&gt; 0, ), &#39;validate_argument_type&#39; =&gt; &#39;tid&#39;, &#39;validate_argument_transform&#39; =&gt; 0, &#39;validate_user_restrict_roles&#39; =&gt; 0, &#39;validate_argument_php&#39; =&gt; &#39;&#39;, ), )); $handler-&gt;override_option(&#39;header&#39;, &#39;<?php
  3. $vid = 15; // id словаря
  4. $arg_pos = 1; // номер позиции аргумента, в нашем случает 1
  5. $cols = 3; // кол-во столбцов для отображения
  6. $show_count = TRUE; // показывать или нет кол-во нод в терминах.
  7.  
  8. if (is_numeric(arg($arg_pos))) {
  9.   $tid = arg($arg_pos);
  10.   $terms = taxonomy_get_children($tid, $vid);
  11.   if (!empty($terms)) {
  12.     $output = \'<table class="catalog-page">\';
  13.     $count = 0;
  14.     $total = count($terms);
  15.    
  16.     foreach ($terms as $tid => $term) {
  17.       if ($count % $cols == 0) {
  18.         $output .= \'<tr>\';
  19.       }
  20.      
  21.       $item = l($term->name, taxonomy_term_path($term));
  22.       if ($show_count) {
  23.         $count_nodes = taxonomy_term_count_nodes($term->tid);
  24.         $item .= ($count_nodes) ? " ($count_nodes)" : " (0)";
  25.       }
  26.      
  27.       $count++;
  28.       $output .= \'<td>\'. $item .\'</td>\';
  29.       if ($count % $cols == 0 || $count == $total) {
  30.         $output .= \'</tr>\';
  31.       }
  32.     }
  33.     $output .= \'</table>\';
  34.     return $output;
  35.   }
  36. }
  37. ?>&#39;); $handler-&gt;override_option(&#39;header_format&#39;, &#39;3&#39;); $handler-&gt;override_option(&#39;header_empty&#39;, 0); $handler-&gt;override_option(&#39;path&#39;, &#39;catalog/%&#39;); $handler-&gt;override_option(&#39;menu&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;description&#39; =&gt; &#39;&#39;, &#39;weight&#39; =&gt; 0, &#39;name&#39; =&gt; &#39;navigation&#39;, )); $handler-&gt;override_option(&#39;tab_options&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;description&#39; =&gt; &#39;&#39;, &#39;weight&#39; =&gt; 0, &#39;name&#39; =&gt; &#39;navigation&#39;, )); $handler = $view-&gt;new_display(&#39;page&#39;, &#39;Корень каталога&#39;, &#39;page_2&#39;); $handler-&gt;override_option(&#39;arguments&#39;, array( &#39;null&#39; =&gt; array( &#39;default_action&#39; =&gt; &#39;empty&#39;, &#39;style_plugin&#39; =&gt; &#39;default_summary&#39;, &#39;style_options&#39; =&gt; array(), &#39;wildcard&#39; =&gt; &#39;all&#39;, &#39;wildcard_substitution&#39; =&gt; &#39;Все&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;breadcrumb&#39; =&gt; &#39;&#39;, &#39;default_argument_type&#39; =&gt; &#39;fixed&#39;, &#39;default_argument&#39; =&gt; &#39;&#39;, &#39;validate_type&#39; =&gt; &#39;none&#39;, &#39;validate_fail&#39; =&gt; &#39;not found&#39;, &#39;must_not_be&#39; =&gt; 0, &#39;id&#39; =&gt; &#39;null&#39;, &#39;table&#39; =&gt; &#39;views&#39;, &#39;field&#39; =&gt; &#39;null&#39;, &#39;validate_user_argument_type&#39; =&gt; &#39;uid&#39;, &#39;validate_user_roles&#39; =&gt; array( &#39;2&#39; =&gt; 0, ), &#39;override&#39; =&gt; array( &#39;button&#39; =&gt; &#39;Use default&#39;, ), &#39;relationship&#39; =&gt; &#39;none&#39;, &#39;default_options_div_prefix&#39; =&gt; &#39;&#39;, &#39;default_argument_fixed&#39; =&gt; &#39;&#39;, &#39;default_argument_user&#39; =&gt; 0, &#39;default_argument_php&#39; =&gt; &#39;&#39;, &#39;validate_argument_node_type&#39; =&gt; array( &#39;art&#39; =&gt; 0, &#39;children&#39; =&gt; 0, &#39;eda&#39; =&gt; 0, &#39;hotel&#39; =&gt; 0, &#39;nightlife&#39; =&gt; 0, &#39;sauna&#39; =&gt; 0, &#39;sport&#39; =&gt; 0, &#39;transport&#39; =&gt; 0, ), &#39;validate_argument_node_access&#39; =&gt; 0, &#39;validate_argument_nid_type&#39; =&gt; &#39;nid&#39;, &#39;validate_argument_vocabulary&#39; =&gt; array( &#39;15&#39; =&gt; 0, &#39;16&#39; =&gt; 0, &#39;1&#39; =&gt; 0, &#39;2&#39; =&gt; 0, &#39;14&#39; =&gt; 0, &#39;12&#39; =&gt; 0, &#39;8&#39; =&gt; 0, &#39;6&#39; =&gt; 0, &#39;5&#39; =&gt; 0, &#39;13&#39; =&gt; 0, &#39;7&#39; =&gt; 0, &#39;9&#39; =&gt; 0, &#39;4&#39; =&gt; 0, &#39;11&#39; =&gt; 0, &#39;10&#39; =&gt; 0, ), &#39;validate_argument_type&#39; =&gt; &#39;tid&#39;, &#39;validate_argument_transform&#39; =&gt; 0, &#39;validate_user_restrict_roles&#39; =&gt; 0, &#39;validate_argument_php&#39; =&gt; &#39;&#39;, ), &#39;null_1&#39; =&gt; array( &#39;default_action&#39; =&gt; &#39;default&#39;, &#39;style_plugin&#39; =&gt; &#39;default_summary&#39;, &#39;style_options&#39; =&gt; array(), &#39;wildcard&#39; =&gt; &#39;all&#39;, &#39;wildcard_substitution&#39; =&gt; &#39;Все&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;breadcrumb&#39; =&gt; &#39;&#39;, &#39;default_argument_type&#39; =&gt; &#39;fixed&#39;, &#39;default_argument&#39; =&gt; &#39;&#39;, &#39;validate_type&#39; =&gt; &#39;none&#39;, &#39;validate_fail&#39; =&gt; &#39;not found&#39;, &#39;must_not_be&#39; =&gt; 0, &#39;id&#39; =&gt; &#39;null_1&#39;, &#39;table&#39; =&gt; &#39;views&#39;, &#39;field&#39; =&gt; &#39;null&#39;, &#39;validate_user_argument_type&#39; =&gt; &#39;uid&#39;, &#39;validate_user_roles&#39; =&gt; array( &#39;2&#39; =&gt; 0, ), &#39;override&#39; =&gt; array( &#39;button&#39; =&gt; &#39;Use default&#39;, ), &#39;relationship&#39; =&gt; &#39;none&#39;, &#39;default_options_div_prefix&#39; =&gt; &#39;&#39;, &#39;default_argument_fixed&#39; =&gt; &#39;&#39;, &#39;default_argument_user&#39; =&gt; 0, &#39;default_argument_php&#39; =&gt; &#39;&#39;, &#39;validate_argument_node_type&#39; =&gt; array( &#39;art&#39; =&gt; 0, &#39;children&#39; =&gt; 0, &#39;eda&#39; =&gt; 0, &#39;hotel&#39; =&gt; 0, &#39;nightlife&#39; =&gt; 0, &#39;sauna&#39; =&gt; 0, &#39;sport&#39; =&gt; 0, &#39;transport&#39; =&gt; 0, ), &#39;validate_argument_node_access&#39; =&gt; 0, &#39;validate_argument_nid_type&#39; =&gt; &#39;nid&#39;, &#39;validate_argument_vocabulary&#39; =&gt; array( &#39;15&#39; =&gt; 0, &#39;16&#39; =&gt; 0, &#39;1&#39; =&gt; 0, &#39;2&#39; =&gt; 0, &#39;14&#39; =&gt; 0, &#39;12&#39; =&gt; 0, &#39;8&#39; =&gt; 0, &#39;6&#39; =&gt; 0, &#39;5&#39; =&gt; 0, &#39;13&#39; =&gt; 0, &#39;7&#39; =&gt; 0, &#39;9&#39; =&gt; 0, &#39;4&#39; =&gt; 0, &#39;11&#39; =&gt; 0, &#39;10&#39; =&gt; 0, ), &#39;validate_argument_type&#39; =&gt; &#39;tid&#39;, &#39;validate_argument_transform&#39; =&gt; 0, &#39;validate_user_restrict_roles&#39; =&gt; 0, &#39;validate_argument_php&#39; =&gt; &#39;&#39;, ), )); $handler-&gt;override_option(&#39;empty&#39;, &#39;<?php
  38. $vid = 15; // id словаря
  39. $cols = 3; // кол-во столбцов для отображения
  40. $limit = 3; // кол-во выводимых дочерных терминов
  41.  
  42. $tree = taxonomy_get_tree($vid, 0, -1, 1);
  43. if (!empty($tree)) {
  44.   $output = \'<table class="catalog-root">\';
  45.   $count = 0;
  46.   $total = count($tree);
  47.  
  48.   foreach ($tree as $tid => $term) {
  49.     if ($count % $cols == 0) {
  50.       $output .= \'<tr>\';
  51.     }
  52.    
  53.     $item = \'<h2>\'. l($term->name, taxonomy_term_path($term)) .\'</h2>\';
  54.     $children_list = array();
  55.     $children = taxonomy_get_children($term->tid, $vid);
  56.     $i = 1;
  57.     foreach (taxonomy_get_children($term->tid, $vid) as $child) {
  58.       $children_list[] = l($child->name, taxonomy_term_path($child));
  59.       if ($limit != 0 && $i >= $limit) break;
  60.       $i++;
  61.     }
  62.     if (count($children) > $limit) {
  63.       $children_list[] = l(\'...\', taxonomy_term_path($term));
  64.     }
  65.     $count++;
  66.     $item .= implode(\' / \', $children_list);
  67.     $output .= \'<td>\'. $item .\'</td>\';
  68.     if ($count % $cols == 0 || $count == $total) {
  69.       $output .= \'</tr>\';
  70.     }
  71.   }
  72.   $output .= \'</table>\';
  73.  
  74.   return $output;
  75. }
  76. ?>&#39;); $handler-&gt;override_option(&#39;empty_format&#39;, &#39;3&#39;); $handler-&gt;override_option(&#39;path&#39;, &#39;catalog/all&#39;); $handler-&gt;override_option(&#39;menu&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;description&#39; =&gt; &#39;&#39;, &#39;weight&#39; =&gt; 0, &#39;name&#39; =&gt; &#39;navigation&#39;, )); $handler-&gt;override_option(&#39;tab_options&#39;, array( &#39;type&#39; =&gt; &#39;none&#39;, &#39;title&#39; =&gt; &#39;&#39;, &#39;description&#39; =&gt; &#39;&#39;, &#39;weight&#39; =&gt; 0, &#39;name&#39; =&gt; &#39;navigation&#39;, ));</p>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top