<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://gotdrupal.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>GotDrupal.com | Drupal Tutorial Site - preprocess functions</title>
 <link>http://gotdrupal.com/taxonomy/term/18/0</link>
 <description></description>
 <language>en</language>
<item>
 <title>How To: Unique Pages by Content Type</title>
 <link>http://gotdrupal.com/videos/unique-pages-by-content-type</link>
 <description>&lt;!-- google_ad_section_start --&gt;&lt;p&gt;Drupal provides a lot of &lt;a href=&quot;http://drupal.org/node/190815&quot; title=&quot; Core templates and suggestions&quot;&gt;default template files&lt;/a&gt; when it comes to page, node and block&amp;nbsp;output.&lt;/p&gt;
&lt;p&gt;There are, however, a few instances when you may want to theme a page based on the content type - such as having a dedicated page for when videos are viewed (I&#039;m doing just such a thing on this&amp;nbsp;site).&lt;/p&gt;
&lt;p&gt;What you need to do then is tell Drupal about the dedicated and specific template file you wish to use for that content type. The way to do this is with &lt;a href=&quot;http://drupal.org/node/223430&quot; title=&quot; Overriding themable output&quot;&gt;preprocess functions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This video shows you the few lines of code you need. Of course, if you don&#039;t want to watch the video then all you need is&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;/**&lt;br /&gt; * Adding or modifying variables before page render.&lt;br /&gt; */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;phptemplate_preprocess_page&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$vars&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// Page change based on node-&amp;gt;type&lt;br /&gt;&amp;nbsp; // Add a new page-&lt;span class=&quot;caps&quot;&gt;TYPE&lt;/span&gt; template to the list of templates used&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$vars&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;node&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// Add template naming suggestion. It should alway use hyphens.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$vars&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;template_files&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;][] = &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;page-&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;. &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;str_replace&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;_&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;-&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$vars&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;node&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;!-- google_ad_section_end --&gt;</description>
 <comments>http://gotdrupal.com/videos/unique-pages-by-content-type#comments</comments>
 <category domain="http://gotdrupal.com/category/tags/development">development</category>
 <category domain="http://gotdrupal.com/category/skill-level/intermediate">Intermediate</category>
 <category domain="http://gotdrupal.com/category/tags/pagetplphp">page.tpl.php</category>
 <category domain="http://gotdrupal.com/category/tags/preprocess-functions">preprocess functions</category>
 <category domain="http://gotdrupal.com/category/tags/themeing">themeing</category>
 <pubDate>Tue, 09 Sep 2008 23:54:32 +0000</pubDate>
 <dc:creator>Matt Petrowsky</dc:creator>
 <guid isPermaLink="false">21 at http://gotdrupal.com</guid>
</item>
</channel>
</rss>

