Drupal6 视图:输出“分类:所有术语”包含两个术语作为两个链接的字段

发布于 2024-09-19 07:58:40 字数 1142 浏览 7 评论 0原文

简而言之:我正在制作一个自定义视图,我想要一个列出与 NID 关联的两个分类术语的字段,以输出为两个不同的链接,这两个链接返回视图的参数(term1 到 view/term1,term2 到 view/term2。相反,它输出为一个聚合链接(term1 和 term2 都输出 view/term1%0Aterm2。

我做错了什么还是不可能?

详尽地:

我正在构建一个产品视图(页面输出位于 http://example.com/products) 在 drupal ubercart 站点中,因为内置的 ubercart 目录 psuedo-view 没有执行此操作对我来说,其中一些产品属于多个分类术语(在同一词汇表中) - 例如,product_example1 属于术语蓝色和glowinthedark,product_example2 属于红色和glowinthedark,product-example3 属于蓝色

。基于这样的术语限制视图:产品/红色、产品/发光黑等返回我制作的这个漂亮的视图,但仅适用于与分类术语红色、发光黑等相关的产品 - 所以可以正常工作。意见太棒了!

现在,我希望此视图中显示的每个产品都链接到生成的产品/[术语] 页面。将字段“taxonomy:all terms”输出为带有替换参数 products/[tid] 的链接适用于一个术语(product_example3 的字段适用于它的一个术语:/products/blue(views is Awesome!),但是,问题如下,它不适用于两个术语(或者我假设超过两个术语),无论该字段作为列表输出还是使用简单的分隔符,这都是正确的,因此,对于product_example之一,该字段列出了蓝色和glowinthedark这两个术语(正确分隔为列表项或使用所选的“,”简单分隔符),但这两个术语都输出相对链接 products/blue%0Aglowinthedark,

这很清楚吗?我无法想象我是第一个遇到这种情况的人,我可能会放弃,因为它并不那么重要,而且我可以想到一些不太令人满意但仍然可行的解决方法,但我认为你们都可能有一些见解。唯一给我希望的是,当选中“将此字段链接到其术语页面”复选框时,视图会成功输出两个单独的行项目,并链接到两个单独的术语页面。

我也在 Drupal.org 上发布了这个问题。感谢您抽出时间!

Briefly: I'm making a custom view, I want a field listing the two taxonomy terms associated with an NID to output as two distinct links which return arguments for the view (term1 to view/term1, term2 to view/term2. Rather, it outputs as one aggregated link (both term1 and term2 output view/term1%0Aterm2.

Am I doing something wrong or is this not possible?

Exhaustively:

I am constructing a view of products (with the page output at http://example.com/products) in an drupal ubercart site because the built-in ubercart catalog psuedo-view isn't doing it for me. Some of these products belong to more than one taxonomy term (within the same vocabulary) - for instance, product_example1 belongs to terms blue and glowinthedark, product_example2 red and glowinthedark, product-example3 just blue.

I've created an argument which limits the view based on terms like so: products/red, products/glowinthedark etc returns this nice view I made but only with products which are associated with taxonomy terms red, glowinthedark, etc - so works as it should. Views is awesome!

Now, I want each product shown in this view to link to the generated product/[term] page(s). Outputting the field "taxonomy:all terms" as a link with replacement argument products/[tid] works for one term (product_example3's field works for its one term: /products/blue (views is awesome!) , but, AND HERE'S THE PROBLEM, it DOESN'T FOR TWO TERMS (or I assume more than two terms). This is true whether the field is output as a list or using a simple seperator. So, for product_example one, the field lists both terms blue and glowinthedark (correctly separated as list items or with the chosen "," simple separator), but both terms output the relative link products/blue%0Aglowinthedark.

Is that clear? I haven't been able to google anyone with a similar situation, strangely, although I can't imagine I'm the first to run into this. I may just give up since it's not all that important and I can think of several less-satisfactory but still doable workarounds, but I thought you all might have some insight. The only thing that gives me hope is that when the "Link this field to its term page" check box is selected, views successfully outputs two separate line items with links to the two separate terms' pages.

I'm also posting this question on Drupal.org. Thanks for your time!

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

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

发布评论

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

评论(1

你又不是我 2024-09-26 07:58:40

嗯...奇怪。我仔细阅读了你的问题。不过我得到了你想要的结果!

  • 我有一个多选分类词汇(我们称之为“部门”)
  • 我有一个单选分类词汇(我们称之为“位置”)

在我的字段部分中,我添加了分类:所有术语

  • 在分类设置中:所有术语我选择“将此字段输出为链接”。在那里,我将“链接路径”设置为产品/[tid]
  • 我确保未选中“将此字段链接到其术语页面”
  • 我使用简单的逗号分隔符
  • “将术语限制为特定词汇”复选框并不重要。这取决于您的业务需求。

根据您的要求,我在一行上依次获得 products/abc、products/xyz 等。即使特定节点具有来自同一分类词汇表的多个术语,这种方法也有效。我没有得到任何 %0A 的东西。

这对我来说是开箱即用的。我尝试了视图 2.11 和视图 3.0-alpha3

尝试升级到最新版本的视图,看看你是否有更好的运气?

Hmmm... strange. I read your question carefully. However I am getting the results that you desire!

  • I have a taxonomy vocabulary that is multiple select (lets call it "Sector")
  • I have a taxonomy vocabulary that is single select (lets call it "Location")

In my fields section, I add Taxonomy: All Terms

  • In the settings for Taxonomy: All Terms I select "Output this field as a link". In there, I set the "Link Path" to product/[tid]
  • I make sure "Link this field to its term page" is NOT checked
  • I use a simple comma separator
  • "Limit terms to a specific vocabulary" checkbox does not matter. It would depend on your business requirements.

As required by you I get products/abc, products/xyz etc. one after another on a single line. This works even if a particular node has multiple terms from the same taxonomy vocabulary. I don't get any %0A stuff.

This works out of the box for me. I tried with both views 2.11 and views 3.0-alpha3

Try upgrading to the latest version of views and see if you have better luck?

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