<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. Is there 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> which 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>

[{'answer_id': 78158, 'author': 'Pierre-Jean Coudert', 'author_id': 8450, 'author_profile': 'https://Stackoverflow.com/users/8450', 'pm_score': 7, 'selected': True, 'text': '<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>\n\n<ul>\n<li>with the "<strong>Node</strong>" 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\']</li>\n<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>\n</ul>\n\n<p>Thanks to previous responses, I\'ve used the following tools :</p>\n\n<ul>\n<li>In the \'Basic Settings\' block, the \'Theme: Information\' to see all the different templates you can modify.</li>\n<li>The <a href="http://drupal.org/project/devel" rel="noreferrer">Devel module</a>\'s "Theme developer" to quickly find the field variable names.</li>\n<li><a href="http://views-help.doc.logrus.com/" rel="noreferrer">View 2 documentation</a>, especially the <a href="http://views-help.doc.logrus.com/help/views/using-theme" rel="noreferrer">"Using Theme"</a> page.</li>\n</ul>\n'}, {'answer_id': 78330, 'author': 'calebbrown', 'author_id': 7007, 'author_profile': 'https://Stackoverflow.com/users/7007', 'pm_score': 5, 'selected': False, 'text': "<p>A quick way to find the template files you can create and modify for a view in Views 2.0 is to:</p>\n\n<ol>\n<li>Edit the view</li>\n<li>Select the style (e.g. page, block, default)</li>\n<li>In the 'Basic Settings' block click on 'Theme: Information' to see all the different templates you can modify.</li>\n</ol>\n"}, {'answer_id': 78620, 'author': 'Garrett Albright', 'author_id': 11023, 'author_profile': 'https://Stackoverflow.com/users/11023', 'pm_score': 4, 'selected': False, 'text': '<p>The <a href="http://drupal.org/project/devel" rel="noreferrer">Devel module</a>\'s "Theme developer" feature is handy for seeing what template files Drupal is looking for when it goes to theme something. See the screenshot on that page for an example.</p>\n'}, {'answer_id': 1248513, 'author': 'userp2m3h', 'author_id': 152933, 'author_profile': 'https://Stackoverflow.com/users/152933', 'pm_score': 2, 'selected': False, 'text': '<p>My shortcut option.</p>\n\n<ol>\n<li><p>Go to <strong>theme.inc</strong> file in <strong><code>YOUR_MODULE_DIR</code>/views/theme/</strong> folder.</p></li>\n<li><p>In the <strong><code>_views_theme_functions</code></strong> function print the <strong>$themes</strong> variable or put a breakpoint on the last line of the function to see the content of the variable.</p></li>\n</ol>\n\n<p>Just convert <strong><code>views_view</code></strong> to <strong>views-view</strong> and __ to -- and add your template extension to get desired file name.</p>\n\n<p>For example if an element of the <strong>$themes</strong> array is <strong><code>views_view__test_view__block</code></strong>  (where <code>test_view</code> is the name of your view) then the name of the template file would be <strong>views-view--test_view--block.tpl.php</strong>.</p>\n'}, {'answer_id': 1598171, 'author': 'svassr', 'author_id': 193489, 'author_profile': 'https://Stackoverflow.com/users/193489', 'pm_score': 3, 'selected': False, 'text': '<p>for me <b>block-views-myViewName-myBlockId.tpl.php</b> works</p>\n'}, {'answer_id': 2306571, 'author': 'Sbhambry', 'author_id': 130927, 'author_profile': 'https://Stackoverflow.com/users/130927', 'pm_score': 2, 'selected': False, 'text': '<p>In my opinion the simplest way to decide which template file to use for theming the views is :\n1) Click on admin/build/views/edit/ViewName -> Basic Settings -> Theme</p>\n\n<p>Clicking this would list all the possible template files. Highlighted (File names in Bold) files indicate which template file is being used to do theme what part of the view. After incorporating the required changes in the relevant view template file RESCAN .. now you should be able to see the changed template file highlighted . </p>\n'}, {'answer_id': 3349883, 'author': 'David Eads', 'author_id': 371064, 'author_profile': 'https://Stackoverflow.com/users/371064', 'pm_score': 3, 'selected': False, 'text': '<p>You should also check out <a href="http://drupal.org/project/semanticviews" rel="noreferrer">Semantic Views</a>.  For simple Views theming, it is <em>really</em> handy.</p>\n'}, {'answer_id': 5420512, 'author': 'James', 'author_id': 673434, 'author_profile': 'https://Stackoverflow.com/users/673434', 'pm_score': 3, 'selected': False, 'text': '<p>One tip:</p>\n\n<p>You\'ll likely have a number of views which require similar formatting.  Creating templates for each of these views and copying them creates a nightmare of code branching - if you\'re asked to change the whole look and feel of the site (implying changing the display of each of these views formatted in this particular way), you have to go back and edit each of these separately.</p>\n\n<p>Instead of using the views interface to select new templates for views, I sometimes simply insert some code branching into a single views file.  E.g. for one site in <code>views-view-fields.tpl.php</code> I have:</p>\n\n<pre><code>if($view-&gt;name == \'articleList\' || $view-&gt;name == \'frontList\' \n|| $view-&gt;name == \'archiveList\') {\n/* field formatting code */\n} else {\n/* the default code running here */\n}\n</code></pre>\n\n<p>This then modifies the fields in the way I want only for this family of Views = articleList, frontList and archiveList - and for other views using this template runs the code one normally finds in this template.  If the client asks, "Hey, could you make those pages showing the archives &amp; that list on the front page to look more like ( ... )", it\'s simply a matter of my opening &amp; editing this one file, instead of three different files.  Maintenance becomes much more quick &amp; friendly.</p>\n'}, {'answer_id': 7268875, 'author': 'Karel', 'author_id': 722173, 'author_profile': 'https://Stackoverflow.com/users/722173', 'pm_score': 1, 'selected': False, 'text': '<p>If you want to do quick Drupal development with a lot of drag-and-drop, the Display Suite module def. is a something you should use: <a href="http://drupal.org/project/ds" rel="nofollow">http://drupal.org/project/ds</a></p>\n'}, {'answer_id': 41819937, 'author': 'carteblanche', 'author_id': 7460714, 'author_profile': 'https://Stackoverflow.com/users/7460714', 'pm_score': 0, 'selected': False, 'text': '<p>According to me there are two ways to do it:</p>\n\n<p>Programatic Way: </p>\n\n<ol>\n<li>Go to edit view. </li>\n<li>Select page/block style. </li>\n<li>Go to \'Basic Settings\' and click on \'Theme: Information\' to see all the different templates you can modify. </li>\n<li>Add the html you want to theme and print the variables of the view wherever needed</li>\n</ol>\n\n<p>Configuration Update: <img src="https://i.stack.imgur.com/CvhW1.png" alt="Using the Display suite">The Display suite provides us an option to place your labels inline or above and add even to hide them. Custom classes to each of the view\'s elements can be added too.\nAdvanced options include:</p>\n\n<ul>\n<li>Exportables</li>\n<li>Add your own custom fields in the backend or in your code</li>\n<li>Add custom layouts in your theme (D7 only)</li>\n<li>Change labels, add styles or override field settings (semantic fields).</li>\n<li>Full integration with Views and Panels</li>\n<li>Extend the power of your layouts by installing Field Group</li>\n<li>Optimal performance with Object cache (D6) or Entity cache (D7) integration</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/77694', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8450/']