简体   繁体   English

Drupal视图和URL别名覆盖问题

[英]Drupal Views & URL Alias Override Issue

I have a taxonomy vocabulary called 'catalogue'. 我有一个称为“类别”的分类词汇。 Within this, I have levels of terms. 在此范围内,我有一些术语层次。 Some have sub-terms, some have nodes. 一些具有子术语,一些具有节点。

I have two views to handle these: One to show sub categories, one to show nodes, each with a filter applied based on the URL. 我有两个视图来处理这些问题:一个视图显示子类别,一个视图显示节点,每个视图都基于URL应用了过滤器。 If I go to sub-category/category-name , it would show me all the sub-terms in category name. 如果我转到sub-category/category-name ,它将显示类别名称中的所有子术语。 If I go to product-category/category-name , I get a list of related nodes. 如果转到product-category/category-name ,则会得到相关节点的列表。

With no aliases, the view works properly on sub-category/% . 没有别名,该视图可在sub-category/%上正常工作。 The problem with this is that the generated links for the sub-terms aren't to the view, they're to the term page. 这样做的问题是,子术语的生成链接不是到视图,而是到术语页面。

If I create aliases, it overrides the view and shows no results on sub-category/% pages and default node teasers on product-category/% . 如果我创建别名,它将覆盖视图,并且在sub-category/%页面上不显示任何结果,而在product-category/%上显示默认节点提示。

Can I use aliases with views in this way? 我可以通过这种方式在视图中使用别名吗?

Sounds like you want to re-write the output of the Field instead of creating aliases. 听起来您想重写字段的输出而不是创建别名。 If you're not familiar with that particular feature in Views, see the screenshot below from http://highrockmedia.com/blog/rewriting-drupal-views-output-custom-theming-css 如果您不熟悉Views中的特定功能,请参阅以下http://highrockmedia.com/blog/rewriting-drupal-views-output-custom-theming-css中的屏幕截图

Note that instead of creating a <div> wrapper, you can create your own link as needed. 请注意,您可以根据需要创建自己的链接,而不是创建<div>包装器。 Hopefully this will help you get started in the right direction. 希望这将帮助您朝正确的方向开始。

重写字段输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM