[英]Drupal View (Page) vs Taxonomy
I have the following problem: 我有以下问题:
I use taxonomys (tx) as tags. 我将分类法(tx)用作标签。 They can be added when the node is created.
可以在创建节点时添加它们。 So I don't know how many tx I have or what ID they have.
所以我不知道我有多少个TX或他们有什么ID。 The path of the tx is like the following:
tx的路径如下所示:
/foo/element1 /富/部件1
/foo/element2 /富/ element2的
/foo/element3 /富/元素3
... ...
The secound element is the tx. secound元素是tx。
Now I want to use a view (page) to handle the tx-path: 现在,我想使用一个视图(页面)来处理tx路径:
/foo/% /富/%
The problem is, when I open a path like the one on top I see the theme of the node-taxonomy.tpl.php but not the style I set in the view. 问题是,当我打开类似顶部的路径时,看到的是node-taxonomy.tpl.php的主题,但看不到我在视图中设置的样式。
Whenever I open a path in the form (/foo/not-a-tx) I can see the output of the view. 每当我以(/ foo / not-a-tx)格式打开路径时,都可以看到视图的输出。
Could someone give me a hint how to get out the view output but not the tx-output? 有人可以提示我如何获取视图输出,而不是tx输出吗?
Thanks Sebastian 谢谢塞巴斯蒂安
I solved the problem with this way: 我用这种方式解决了这个问题:
It works Okay for me. 对我来说很好。
Thx to every one. 谢谢每一位。
Do you want to get rid of the taxonomy pages completely? 您是否要完全摆脱分类页面?
If so, you can use a hook_menu_alter() and unset the taxonomy page. 如果是这样,您可以使用hook_menu_alter()并取消设置分类页面。
EX. EX。
hook_menu_alter(&$items) {
unset($items['taxonomy/term/%taxonomy_term']);
}
You'd have to look at the $items array to pinpoint the name of the registered menu path, but I think this is it. 您必须查看$ items数组以查明已注册菜单路径的名称,但是我想就是这样。
This will remove the taxonomy page for all vocabularies however. 但是,这将删除所有词汇的分类页面。
Actually you need to make a view to override the internal drupal path of the taxonomy term page: taxonomy/term/% (where % is the taxonomy id) and not the aliased path, which in your case is foo/% 实际上,您需要查看以覆盖分类术语页面的内部 drupal路径:分类/术语/%(其中%是分类ID),而不是别名路径(在您的情况下为foo /%)
[ Optional but saves work: There is already an example view that is bundled with Drupal that implements the taxonomy view. [ 可选,但是可以节省工作:已经有一个示例视图与Drupal捆绑在一起,实现了分类法视图。 Go to Views > List and you will see the the view is greyed out and it is called
转到“视图”>“列表”,您将看到该视图为灰色,它被称为
Default Node view: taxonomy_term (default)
All you need to do is enable it and modify it to your needs] 您需要做的就是启用它,并根据需要对其进行修改]
Don't worry about the aliases. 不用担心别名。 You can define your URL pattern at
/admin/build/path/pathauto
(make sure pathauto module is enabled. You can download it at http://drupal.org/project/pathauto ). 您可以在
/admin/build/path/pathauto
定义URL模式(确保已启用pathauto模块。可以从http://drupal.org/project/pathauto下载)。 In your case the pattern would be foo/[cat]
where [cat]
is a token for category. 在您的情况下,模式为
foo/[cat]
,其中[cat]
是类别的标记。 Make sure you enter this pattern under Taxonomy Term paths
in the pathauto automated alias settings. 确保在pathauto自动别名设置的
Taxonomy Term paths
下输入此模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.