Drupal 6:分类法在托管领域中蔓延?

发布于 2024-07-25 00:13:45 字数 697 浏览 6 评论 0原文

因此,您有两个分类法,即:“业务类型”和“位置”,

这被分配给名为“业务”的节点。 实际上,当用户创建业务节点时,她必须选择位置“纽约”并输入“信息服务”。 我的问题是当: a) 获取分类法,以及 b)显示分类法

我希望这两个术语彼此分开。 即,我希望能够在“管理字段”视图中移动这两个术语的单独位置,以便可以将它们分组或单独放置。 目前,Drupal 只允许一个条目,称为“TAXONOMY”,它实际上是彼此相邻的两个术语。

这就是我所拥有的: 替代文本 http://www.namhost.com/have.jpg

这就是我想要的: alt text

请记住,我需要能够将其与分层选择一起使用,这意味着内容分类不是一个选项。

So you have two taxonomies, namely: "Business Type" and "Location"

This is assigned to a node called BUSINESS. In effect, when the user creates a BUSINESS node, her has to choose for example, location "New York" and type "Information Services". My problem is when:
a) Capturing the taxonomy, and
b) Displaying the taxonomy

I want the two terms to be separated from each other. I.e. I want to be able to move the two terms individual positions in the MANAGE FIELDS view, so that they can be grouped or placed seperately. Currently, Drupal only allows one entry, called "TAXONOMY" which is effectively the two terms next to each other.

This is what I have:
alt text http://www.namhost.com/have.jpg

This is what I want:
alt text

Bare in mind, I need to be able to use this with Hierarchical Select, which means Content Taxonomy is not an option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不顾 2024-08-01 00:13:45

您必须将问题分为两部分:

  • 表单填写部分,它将所有词汇表一起提供给编辑器。
  • 内容显示部分,您可以在其中分隔词汇。

我将在这里详细介绍第二部分,即有关显示的内容。

使用CCK 计算字段模块 并为要显示的每个词汇表创建一个字段。 将此字段放置在您想要的位置。

按如下方式配置每个字段:

  1. 计算代码上,输入如下内容:
    # Get vocabulary ID from its management URL (/admin/content/taxonomy/edit/vocabulary/[VOCABULARY_ID]) and set here:

$node_field[0]['value'] = "5";

# Also, configure this field as 'Raw Text' on Display Fields
  1. 显示格式上,使用以下内容:
    $vocabulary_id=$node_field_item['value'];

$terms=taxonomy_node_get_terms_by_vocabulary($element['#node'], $vocabulary_id);

foreach ($terms as $tid => $details) {
      # The taxonomy_get_textual_term_hierarchy_by_id() is implemented on the SolutionHub's theme template.php file
      $textualTerms .= taxonomy_get_textual_term_hierarchy_by_id($tid);
}

if (isset($textualTerms)) {
      $display='';
      $display.=$textualTerms;
      $display.='';
}

taxonomy_get_textual_term_hierarchy_by_id() 函数特定于我的网站并定义在 DRUPAL_ROOT/sites/default/themes/mytheme/template.php 中,并以一种奇特的方式简单地重写分类术语文本以显示其整个谱系。 因此,我会得到类似“食物>沙漠>水果>苹果”的内容,而不是“苹果”。 我不会将其粘贴到此处,因为它超出了范围。

如果您的问题是在编辑表单中重新定位词汇,我建议使用内容分类模块。

You'll have to separate your problem in 2 parts:

  • The form filling part, which will have all vocabularies together to the editor.
  • The content display part, which you'll be able to separate vocabularies.

I'll cover here more the second part, about displaying.

Use the CCK computed field module and create one field for each vocabulary you want to display. Position this field where you want them.

Configure each field as follows:

  1. On the Computed Code, put something like this:
    # Get vocabulary ID from its management URL (/admin/content/taxonomy/edit/vocabulary/[VOCABULARY_ID]) and set here:

$node_field[0]['value'] = "5";

# Also, configure this field as 'Raw Text' on Display Fields
  1. On Display Format, use this:
    $vocabulary_id=$node_field_item['value'];

$terms=taxonomy_node_get_terms_by_vocabulary($element['#node'], $vocabulary_id);

foreach ($terms as $tid => $details) {
      # The taxonomy_get_textual_term_hierarchy_by_id() is implemented on the SolutionHub's theme template.php file
      $textualTerms .= taxonomy_get_textual_term_hierarchy_by_id($tid);
}

if (isset($textualTerms)) {
      $display='';
      $display.=$textualTerms;
      $display.='';
}

The taxonomy_get_textual_term_hierarchy_by_id() function is specific to my site and is defined in DRUPAL_ROOT/sites/default/themes/mytheme/template.php and simply rewrites the taxonomy term text in a fancy way to show its entire lineage. So instead of "apple" I'll get something like "food > desert > fruit > apple". I won't paste it here cause it is out of scope.

If your problem is to reposition the vocabulary in the edit form, I would suggest the Content Taxonomy module.

天暗了我发光 2024-08-01 00:13:45

您被困在输入表单中一起出现的两个分类法中,它们作为一个包出现。 分类学应该用作分类系统(如动物界分类),以便术语在物理空间中属于一起。

但对于问题的另一半,请记住,您的用户将在输入表单中看到“业务类型”和“位置”标签,而不是您在管理字段时看到的通用“分类法”标签。

You are stuck with the two taxonomies appearing together in the input form, they come as a package. Taxonomy should be used as a classification system (like animal kingdom classifications) so the terms to belong together in physical space.

But for the other half of your question, keep in mind your users will see the 'Business type' and 'Location' labels in the input form, not the generic 'Taxonomy' label that you see when managing fields.

绝對不後悔。 2024-08-01 00:13:45

也许你可以用 ck 做得更好。 通过启用文本(随 cck 一起提供),您可以添加文本字段。 您可以轻松地单独使用它们,也可以将它们与视图、模板等一起使用。

maybe you could do better with cck. by enabling text (comes with cck) you can add text fields. and you can easily use them separately, use them with views, templates, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文