如何快速主题观点? [英] How to quickly theme a view?

查看:93
本文介绍了如何快速主题观点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用CCK和View 2模块定义了一个视图。我想快速定义一个特定于该视图的模板。任何教程或信息?我需要修改哪些文件?






以下是我的发现:(已编辑)实际上有两种方式来主题化视图:字段方式和节点办法。在编辑视图中,您可以选择行样式:节点行样式:字段




  • 使用节点方式,您可以创建一个 node-contentname.tpl.php 将视图中的每个节点调用。您可以使用$ field_name [0] ['value']访问您的cck字段值。 (edit2)您可以使用 node-view-viewname.tpl.php ,只能从此视图中显示的每个节点调用。

  • Field 的方式,您可以为要分别进行主题的每个字段添加一个views-view-field-viewname - field-name-value.tpl.php。



感谢以前的回复,我使用了以下工具:




  • 基本设置块,主题:信息,以查看可以修改的所有不同模板。

  • Devel模块的主题开发者快速找到字段变量名。

  • View 2文档,特别是使用主题页。


解决方案

其实有两种方法s主题视图:字段方式和节点方式。在编辑视图中,您可以选择行样式:节点行样式:字段




  • 使用 Node 方式,可以创建一个node-contentname.tpl.php,在视图中调用每个节点。您可以使用$ field_name [0] ['value']

  • 使用字段方式访问您的cck字段值,您可以添加一个视图-view-field - viewname - 每个要单独主题的字段的field-name-value.tpl.php。



感谢以前的回复,我使用了以下工具:




  • 在基本设置块中,主题:信息查看所有可以修改的不同模板。

  • Devel模块的主题开发者快速找到字段变量名。

  • View 2文档,特别是使用主题页。


I've defined a view with the CCK and View 2 modules. I would like to quickly define a template specific to this view. Any tutorial or information on this ? What are the files I need to modify ?


Here are my findings: (Edited)

In fact there are two ways to theme a view : the "field" way and the "node" way. In "edit View", you can choose "Row style: Node", or "Row style: Fields".

  • with the "Node" way, you can create a node-contentname.tpl.php wich will be called for each node in the view. You'll have access to your cck field values with $field_name[0]['value']. (edit2) You can use node-view-viewname.tpl.php wich will be only called for each node displayed from this view.
  • with the "Field" way, you add a views-view-field--viewname--field-name-value.tpl.php for each field you want to theme individually.

Thanks to previous responses, I've used the following tools :

  • In the 'Basic Settings' block, the 'Theme: Information' to see all the different templates you can modify.
  • The Devel module's "Theme developer" to quickly find the field variable names.
  • View 2 documentation, especially the "Using Theme" page.

解决方案

In fact there are two ways to theme a view : the "field" way and the "node" way. In "edit View", you can choose "Row style: Node", or "Row style: Fields".

  • with the "Node" way, you can create a node-contentname.tpl.php wich will be called for each node in the view. You'll have access to your cck field values with $field_name[0]['value']
  • with the "Field" way, you add a views-view-field--viewname--field-name-value.tpl.php for each field you want to theme individually.

Thanks to previous responses, I've used the following tools :

  • In the 'Basic Settings' block, the 'Theme: Information' to see all the different templates you can modify.
  • The Devel module's "Theme developer" to quickly find the field variable names.
  • View 2 documentation, especially the "Using Theme" page.

这篇关于如何快速主题观点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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