如何快速主题观点? [英] How to quickly theme a view?
问题描述
以下是我的发现:(已编辑)实际上有两种方式来主题化视图:字段方式和节点办法。在编辑视图中,您可以选择行样式:节点
或行样式:字段
。
- 使用节点方式,您可以创建一个 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。
感谢以前的回复,我使用了以下工具:
其实有两种方法s主题视图:字段方式和节点方式。在编辑视图中,您可以选择行样式:节点
或行样式:字段
。
- 使用 Node 方式,可以创建一个node-contentname.tpl.php,在视图中调用每个节点。您可以使用$ field_name [0] ['value']
- 使用字段方式访问您的cck字段值,您可以添加一个视图-view-field - viewname - 每个要单独主题的字段的field-name-value.tpl.php。
感谢以前的回复,我使用了以下工具:
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屋!