<HTML>
<HEAD>
<TITLE>Re: [support] Overriding page.tpl.php for node type...</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Again, I appreciate all the help.<BR>
<BR>
It appears I’ve been mistaken. It’s not that my page-[contenttype].tpl.php isn’t being recognized, it’s that components on it are not being rendered.<BR>
<BR>
I put some text into the template and I see it show up when I go to <a href="http://localhost/contenttype">http://localhost/contenttype</a> so the page is recognized. But the node is not rendered, nor are other elements that are rendered when I go to <a href="http://localhost/node.">http://localhost/node.</a><BR>
<BR>
I’ll probably just have to attempt to debug this further. I just find it weird that these things aren’t coming up. I might have to do more work with the pre-process methods.<BR>
<BR>
<BR>
On 4/10/09 11:46 AM, "John Callahan" <john.callahan@UDel.Edu> wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Could the problem also be that the base template file needs to also<BR>
exist? For example, in order for node-[content type].tpl.php to work,<BR>
node.tpl.php must also exist and be in the same directory. Maybe the<BR>
same goes for page templates?<BR>
<BR>
- John<BR>
<BR>
<BR>
<BR>
<BR>
Aldo Martinez Selleras wrote:<BR>
> look, that was my guide<BR>
><BR>
> Different page templates for different content types<BR>
> Description<BR>
><BR>
> Once upon a time there was a drupal themer working on a dark and stormy night,<BR>
> he sat there wondering how to make different page templates for certain<BR>
> content types on his site. He thought about how the drupal template system<BR>
> seems to be missing this for some reason... Suddenly, he had a vision! Like a<BR>
> ray of light bringing, hope and happiness down from the heavens!! oh yes!!<BR>
> Resolution<BR>
><BR>
> <?php<BR>
> // Add additional template suggestions<BR>
> function _phptemplate_variables($hook, $vars) {<BR>
> switch ($hook) {<BR>
> case 'page': <BR>
> // Add page template suggestions based on node type, if we aren't<BR>
> editing the node.<BR>
> if ($vars['node'] && arg(2) != 'edit') {<BR>
> $vars['template_files'][] = 'page-'. $vars['node']->type;<BR>
> }<BR>
> break;<BR>
> }<BR>
> return $vars;<BR>
> }<BR>
> ?><BR>
><BR>
> This means if you have a content type called event and you want it to have a<BR>
> custom page layout, just copy page.tpl.php to page-event.tpl.php.<BR>
><BR>
> got it?<BR>
><BR>
> just dump the code into template.php, then make a page template called<BR>
> page-[CONTENT TYPE].tpl.php<BR>
><BR>
> and drupal will use that instead<BR>
> <BR>
> Can this be achieved for node.tpl<BR>
><BR>
> Hi,<BR>
><BR>
> Can we have different node templates based on the node types. Is this possible<BR>
> in Drupal?<BR>
> Posted by Visitor (not verified) on Thu, 2008-08-21 02:07<BR>
><BR>
><BR>
> As of Drupal 5, just copy your node.tpl.php file to whichever<BR>
> node-CONTENT_TYPE.tpl.php and that template file will be used for theming<BR>
> nodes of that type.<BR>
><BR>
> For example, node-event.tpl.php.<BR>
> Posted by Benjamin Melançon on Thu, 2008-08-21 05:41<BR>
><BR>
><BR>
> <BR>
--<BR>
[ Drupal support list | <a href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>