对 Views 和 Pathauto 如何协同工作的基本理解 [英] Fundamental understanding of how Views and Pathauto work together

查看:24
本文介绍了对 Views 和 Pathauto 如何协同工作的基本理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在理解何时使用 pathauto 规则以及何时使用视图页面路径时遇到了基本问题.我有几种自定义内容类型,我使用块来显示某些路径上节点的某些部分.然后我使用视图页面来显示路径上的主节点.

I am having fundamental problems understanding when to use a pathauto rule, and when to use a views page path. I have several custom content types, and I am using blocks to display certain parts of nodes on certain paths. Then I use a views page to display the main node on a path.

当我这样做时,我不能使用 pathauto,因为它会覆盖我在视图中设置的路径.例如..如果我设置了location/%"的视图页面路径,并为location/[title-raw]"的位置内容类型设置了pathauto规则,当我浏览到mysite.com/location/mylocation pathauto获胜,并简单地显示完整节点.如果我不能使用 pathauto,我就不能在我的块上添加参数,因为 Drupal 不再理解它在看什么了!啊!

When I do this, I can't use pathauto, as it overrides the paths I set in views. Eg.. If I set up a views page path of "location/%", and set a pathauto rule for Location content types of "location/[title-raw]", when I browse to mysite.com/location/mylocation pathauto wins, and simply displays the full node. And if I can't use pathauto, I can't add arguments on my blocks, because Drupal doesn't understand what it's looking at anymore! Arrrg!

我试过安装 Util,并改变模块的重量,但没有奏效.但我不应该做任何疯狂的事情,比如改变模块权重,对吧?我的想法一定有一些基本的缺陷.

I've tried installing Util, and altering the weight of the modules, but that didn't work. But I shouldn't have to do anything crazy like alter module weights, right? There must be some basic flaw in my thinking.

您如何使路径和内容井井有条?

How do you keep your paths and content organized?

助我如水般流动,助我成为杯子.

Help me flow like water, help me become the cup.

推荐答案

好的,我已经解决了我的问题.我应该问的实际问题是:

Ok, I've solved my problem. The actual question I should have asked was:

如何显示单个节点?

我基本上是使用视图来设计单个节点的样式.当然,这不是 Views 的设计目的.查看其他有类似问题的人:
http://drupal.org/node/400400
http://drupal.org/node/316907

I was basically using Views to style a single node. Of course, this is not what Views is designed for. See others with similar problems:
http://drupal.org/node/400400
http://drupal.org/node/316907

我的解决方案:

  • 让 pathauto 完成所有工作.
  • 根据主题添加、排列和样式化您的内容层.

换句话说:删除视图页面视图,并使用相应的位置/%路径.按照您想要的方式设置您的 pathauto 规则.将 node.tpl.php 复制到您的主题目录.复制该文件并将其重命名为 node-[type].tpl.php.更改 node-[type].tpl.php 而不是在 Views 中设置规则.

In more words: remove views page view, taking the corresponding location/% path with it. Set up your pathauto rules the way you want. Copy node.tpl.php to your theme directory. Duplicate that file and rename it node-[type].tpl.php. Alter node-[type].tpl.php instead of setting up rules in Views.

有关主题特定 CCK 内容类型的更多帮助,请参阅:
http://drupal.org/node/266817

For more help theming a specific CCK content type see:
http://drupal.org/node/266817

别忘了!使用 phptemplate node-[type].tpl.php 建议时,您的主题目录中还必须有原始的 node.tpl.php 模板,否则模板建议将被忽略.

Don't forget! When using phptemplate node-[type].tpl.php suggestions, there must also be an original node.tpl.php template present in your theme directory or the template suggestion is ignored.

希望能帮到别人!

这篇关于对 Views 和 Pathauto 如何协同工作的基本理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆