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