diff options
authorEarl Miles2008-06-12 16:17:00 +0000
committerEarl Miles2008-06-12 16:17:00 +0000
commit1b7521aa42eb5d1a3a16349706a0a757ed211f27 (patch)
parent2add91ad22ed11f0ad62a92f244821e1560c5246 (diff)
Add a help page describing how to use the templates.
2 files changed, 41 insertions, 0 deletions
diff --git a/help/using-theme.html b/help/using-theme.html
new file mode 100644
index 0000000..5f9a7f9
--- /dev/null
+++ b/help/using-theme.html
@@ -0,0 +1,37 @@
+<!-- $Id$ -->
+Views theme templates are straightforward to use with the Drupal theming system. If you are unfamiliar with the theming system at all, you should probably at least read <a href=""> theming documentation</a>. That said, these are the important things you need to know:
+<li> Copy a base Views template to one of the names provided from the Theme: Information section of the View. Copy this template right into your theme directory. </li>
+<li> Clear the theme registry. See the <a href="">instructions</a> for how to do this. </li>
+<li> Your new template should now operate; assuming you picked a nicely named template that includes the view name, that template should now be active for your view. A good example is <strong>views-view-list--foobar.tpl.php</strong> which would work for a view named 'foobar'.</li>
+<li> You can now modify this template all you like.
+For any template that uses fields, the fields will be in array. In order to use this effectively, you will need to understand enough PHP to fetch data from an array. This is a place where the <a href="">devel module</a> can really help you, because you can use its dsm() function right in your template to see what variables it uses. There is an alternative to dsm() that works without devel module, but it's a bit longer to use.
+For example, I placed the following code inside a loop in views-view-table.php.php:
+<code> &lt;?php drupal_set_message('&lt;pre&gt;' . var_export($row, true) . '&lt;/pre&gt;'); ?&gt;
+And it produced this output:
+<code> array (
+ 'nid' => '97',
+ 'title' => 'Scisco Ideo Vicis Feugiat Qui',
+ 'name' => 'luwrepuslan',
+ )
+My view had three fields:
+<code>Node: Nid
+Node: Title
+User: Name
+The contents of the $row variable included these fields, in precisely the order that I had arranged them to using the Views rearrange link. Also worth noting, though, is that each field also has an identifier so it can easily be pulled out of the row should I want to display it differently. Using
+<code>&lt;?php print $row['title']; ?&gt;
+Would print just the title for that row. Please remember that I'm doing this inside the loop, so this will get repeated for every row of the view.
+The important thing here is that Views does provide IDs. Views doesn't tell you what these IDs are, but it's easy to get them by dumping the row data and doing a simple visual inspection. Views does guarantee that these IDs will not change, unless you actually add a new field and remove the existing one (in which case 'title', above, would become 'title1').
diff --git a/help/ b/help/
index 4c22ea3..72bb2b2 100644
--- a/help/
+++ b/help/
@@ -98,5 +98,9 @@ title = "Path options (page display)"
title = "Theme information"
+title = "Using Views templates"
+parent = analyze-theme
title = What are overrides? \ No newline at end of file