Подобие taxonomy_menu на views2

Главные вкладки

Аватар пользователя abix abix 16 августа 2009 в 13:08

Реально ли такое реализовать? Бъюсь уже 4 день.
Удалось вывести таксономию в виде:

-Категория1
-----Подкатегория1
-----Подкатегория2
-Категория2
-----Подкатегория1
-----Подкатегория2

С помощью аргументов частично удалось присвоить ссылки (правда пока только категориям) (вид ссылки catalog/%1/%3, где %1 - id словаря; %3 - id термина родителя)

Вот напрашиваются два вопроса.
Первый

Как свормировать ссылки подкатегориям во views?
Напрмер:
Словарь(id 123)
-Категория1(id 1)
-----Подкатегория1(id 3)
-----Подкатегория2(id 4)
-Категория2(id 2)
-----Подкатегория1(id 5)- вот тут ссылка по идее должна быть вида catalog/%123/%5 (где %123- id словаря, %5 - id)
--------------Подкатегория(id 7) - catalog/%123/%7 и т.д.
-----Подкатегория2(id 6)

И второй как потом использовать полученную ссылку с аргументами. Если пишу mysite.ru/catalog/123/2 - говорит страница не найдена Sad

вот экспорт из views:

$view = new view;
$view->name = 'termincatalog2';
$view->description = 'category2';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'term_data';
$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('relationships', array(
  'parent' => array(
    'label' => 'Родитель',
    'required' => 1,
    'id' => 'parent',
    'table' => 'term_hierarchy',
    'field' => 'parent',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'name' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 1,
      'path' => 'c/7/%3',
      'link_class' => '',
      'alt' => '[name] ',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 1,
    'link_to_taxonomy' => 0,
    'exclude' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'name_1' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 1,
      'path' => 'c/7/%2',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_taxonomy' => 0,
    'exclude' => 1,
    'id' => 'name_1',
    'table' => 'term_data',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'parent',
  ),
  'name_2' => array(
    'label' => 'Название словаря',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 1,
    'id' => 'name_2',
    'table' => 'vocabulary',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'parent',
  ),
));
$handler->override_option('arguments', array(
  'vid' => 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' => 'none',
    'validate_fail' => 'not found',
    'id' => 'vid',
    'table' => 'vocabulary',
    'field' => 'vid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'parent',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '7',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'panel' => 0,
      'afisha' => 0,
      'category' => 0,
      'container' => 0,
      'firms' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_user_restrict_roles' => 0,
    'validate_argument_vocabulary' => array(
      '4' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_argument_php' => '',
  ),
  'parent' => 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',
    'break_phrase' => 1,
    'not' => 0,
    'id' => 'parent',
    'table' => 'term_hierarchy',
    'field' => 'parent',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '17+18+19+20+68+69+70+80+71+72+74+73+75+76+77+78+79',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'panel' => 0,
      'afisha' => 0,
      'category' => 0,
      'container' => 0,
      'firms' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_user_restrict_roles' => 0,
    'validate_argument_vocabulary' => array(
      '4' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_argument_php' => '',
  ),
  'parent_1' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Все',
    'title' => '%3',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'taxonomy_term',
    'validate_fail' => 'not found',
    'break_phrase' => 1,
    'not' => 0,
    'id' => 'parent_1',
    'table' => 'term_hierarchy',
    'field' => 'parent',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'panel' => 0,
      'afisha' => 0,
      'category' => 0,
      'container' => 0,
      'firms' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_user_restrict_roles' => 0,
    'validate_argument_vocabulary' => array(
      '7' => 7,
      '4' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
    ),
    'validate_argument_type' => 'tids',
    'validate_argument_transform' => 0,
    'validate_argument_php' => '',
  ),
  'name' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Все',
    'title' => '%4',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'none',
    'path_case' => 'none',
    'transform_dash' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'panel' => 0,
      'afisha' => 0,
      'category' => 0,
      'container' => 0,
      'firms' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_user_restrict_roles' => 0,
    'validate_argument_vocabulary' => array(
      '4' => 0,
      '7' => 0,
      '8' => 0,
      '9' => 0,
      '10' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 0);
$handler->override_option('use_pager', '1');
$handler->override_option('use_more', 1);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => 'name_1',
  'type' => 'ul',
));
$handler->override_option('row_options', array(
  'inline' => array(),
  'separator' => '',
  'hide_empty' => 0,
));
$handler->override_option('exposed_block', TRUE);
$handler = $view->new_display('page', 'Страница', 'page_1');
$handler->override_option('path', 'c/%1/%3');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => 'Каталог1',
  'description' => '',
  'weight' => '0',
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));