【问题标题】:Show Drupal taxonomy subcategories (subterms) on a node page在节点页面上显示 Drupal 分类子类别(子术语)
【发布时间】:2010-10-21 09:06:06
【问题描述】:

我想向 Drupaler 寻求帮助。是否可以在节点页面上显示分类术语的子类别?假设有这样的分类法:

category 1
       subcategory 1
       subcategory 2
       ...

我希望 Ubercart 产品在节点页面上显示类别 1 中的项目具有以下子类别(例如产品)子类别。 1. 并列出指向分类子类别的链接。

Heading
some text...
List of subcats...
footer.

不一定要按这个顺序。它只是说明了这个想法。这可能吗? 提前感谢您的帮助。

【问题讨论】:

  • 我现在没有任何方便的访问权限...但是这不能使用 Views 并提取正确的分类信息来完成吗?
  • 我不确定。也许。我试图实现这一点,但没有令人满意的结果。我无法设置视图。我可能找到了使用 taxonomy_menu 模块和 menu_block 的解决方案。我们会看到的。我会及时通知你。

标签: drupal drupal-6 drupal-taxonomy


【解决方案1】:

大家好,感谢您的回复。我找到了一种使用模块来完成此任务的方法。

 1. Enable Taxonomy menu module
 2. Enable menu block module
 3. Choose in the menu block created your taxonomy menu
 4. Check the "Make the starting level follow the active menu item." option and place the block in your content region :-)

这可能不像写几行PHP代码那么容易,但即使对于非程序员来说也足够了,而且它也可以很容易地修改。

【讨论】:

    【解决方案2】:

    1 - 在你的 node.tpl.php 中设置一些条件来检查你想要加载子类别的页面
    2 - 获取您将从 $node 变量中获得的分类术语名称或术语名称
    3 - 调用此函数并传递正确的参数 taxonomy_get_children($tid, $vid = 0, $key = 'tid')

    我希望它会起作用

    【讨论】:

    • 您好,提前感谢您的回答。但我发现了另一种解决方案,无需接触 tpl 文件。
    • 嗨,Bery,你是如何解决这个问题的,我也面临同样的问题,谢谢
    猜你喜欢
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    • 2015-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多