如何解决分类学悖论?

cod*_*ama 10 views taxonomy drupal-7

我正在使用" 分类显示 "模块.我使用这样我可以按标题而不是ID来排序我的分类术语,就像默认情况下那样.但是,我还创建了一个名为的分类模板:

taxonomy-term--product_literature_category.tpl.php
Run Code Online (Sandbox Code Playgroud)

如果我启用" 分类显示 "模块并覆盖此路径的分类视图:

/taxonomy/term/%
Run Code Online (Sandbox Code Playgroud)

...它还会覆盖我上面指定的模板.更有意义的是,订单将使我的自定义模板覆盖模块.但它似乎没有这样的方式.但是,如果我禁用"分类法显示",它会再次考虑我的模板.

我有两个选择:

  1. 启用"分类法显示"并找到一种覆盖分类法的方法 - product_literature_category.tpl.php
  2. 禁用"分类法显示"并找到一种通过我自己的自定义排序参数对分类术语进行排序的方法.

我认为1很难(因为对同一件事使用两个模板没有多大意义).这就是为什么我倾向于在默认情况下更简单地对分类视图进行排序,或者以其他方式指定分类术语的顺序.

有谁知道如何做到这一点?

UPDATE

现在,我将解决一个问题,即通过模块更改分类术语的排序.这样我就可以只覆盖特定词汇表的排序.任何能够在这个方向上轻推我的指针都会受到高度赞赏吗?

更新2

我创建了teaser_sorter.module并添加了这个函数:

function teaser_sorter_views_query_alter(&$view, &$query)
{
    print '<pre>'; print_r($view); print_r($query); die();
}
Run Code Online (Sandbox Code Playgroud)

我还确保我的模块支持视图:

function teaser_sorter_views_api() {
   return array(
      'api' => 3,
   );
}
Run Code Online (Sandbox Code Playgroud)

我无法让它达到我的"死".换句话说,它永远不会被称为.事实上,我也尝试重写"hook_views_pre_execute",但这也不会被调用.

有任何想法吗?

小智 1

 view :  <google-taxonomy-category class="googlecategoryselectiontool" field-name="goo_cat_id"\xc2\xa0cat-sel=""></google-taxonomy-category>\n\n\n       "class" used for template setup so if I want to use any.tpl then I simply have to  write\xc2\xa0tplname. if no class value given then it will take default template.\n"field-name" it will consist name of the request variable \xc2\xa0which you want to set on checkbox. by default its value going to be "selected_value[]" if no value passed for it.\n      "cat-sel" it will consist of data of which category need to be selected when html load. it will take value like\xc2\xa0<?php echo htmlspecialchars(json_encode($selected_value)); ?> in          \n        which\xc2\xa0$selected_value  is the array of all category id which need to be selected.\xc2\xa0\n
Run Code Online (Sandbox Code Playgroud)\n