Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to quickly theme a view?
    text
    copied!<p>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?</p> <hr> <p><strong>Here are my findings: (Edited)</strong></p> <p>In fact there are two ways to theme a view : the "<strong>field</strong>" way and the "<strong>node</strong>" way. In "edit View", you can choose "<code>Row style: Node</code>", or "<code>Row style: Fields</code>".</p> <ul> <li>with the "<strong>Node</strong>" way, you can create a <strong>node-contentname.tpl.php</strong> which 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 <strong>node-view-viewname.tpl.php</strong> wich will be only called for each node displayed from this view.</li> <li>with the "<strong>Field</strong>" way, you add a views-view-field--viewname--field-name-value.tpl.php for each field you want to theme individually.</li> </ul> <p>Thanks to previous responses, I've used the following tools :</p> <ul> <li>In the 'Basic Settings' block, the 'Theme: Information' to see all the different templates you can modify.</li> <li>The <a href="http://drupal.org/project/devel" rel="nofollow noreferrer">Devel module</a>'s "Theme developer" to quickly find the field variable names.</li> <li><a href="http://views-help.doc.logrus.com/" rel="nofollow noreferrer">View 2 documentation</a>, especially the <a href="http://views-help.doc.logrus.com/help/views/using-theme" rel="nofollow noreferrer">"Using Theme"</a> page.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload