I've enabled CCK in modules. I've created a content type called 'insidepages'. I'm trying to create my own layout for this content type. So, I've created a new file in themes/mytheme called
node-insidepages.tpl.php.
That didn't work, so I tried
insidepages.tpl.php
That didn't work, so I tried
page-insidepages.tpl.php
that didn't work either. They both just show what is in page.tpl.php. What am I doing wrong?
Thanks.

Comments

masande’s picture

page level templates will not recognize new content types automatically like node level templates. to redirect all nodes of a certain type to a different page template try adding the following php to the top of your page.tpl.php.

<?php
if ($node->type == 'contenttype') {include ('page-contenttype.tpl.php');return;}
?>

be sure to put the machine readable name for your custom content type in place of 'contenttype' in the above code. that should do it.

also, node-contenttype.tpl.php will automatically control the node output of your new content type (again replace 'contenttype' with the machine readable name).

best of luck with your drupal project.

Mark Sanders
Q Collective

Mark Sanders
Q Collective

tayknight’s picture

Thanks, Mark. This worked.

marcvangend’s picture

According to http://drupal.org/node/17565, node-insidepages.tpl.php should work. Are you sure that "insidepages" is the 'type' (machine readable name) of this content type? There can be a difference between the 'type' and the 'name' (which is the human-readable name of your content type).

tayknight’s picture

The node name (from admin/content/types/insidepage) is "Inside page" and the type is "insidepage". So I'm stumped, cause I read that handbook page as well.

marcvangend’s picture

OK let me get this clear... In your first post you wrote that you tried "node-insidepages.tpl.php", but if the type is "insidepage", the template name should be "node-insidepage.tpl.php" (without the plural "s"). Just a typo?

tayknight’s picture

I got it to work using the above technique, but I'm still confused about why I had to do it that way.