Theming Custom Content Types

Joined: 01/22/2009

I have some questions about custom theming in Drupal 6. The documentation seems to be different than for Drupal 5 but is a little sketchy. Do you still make the "node-something_something.tpl" file as in 5? For instance, in the site I built for our church I had one called node-user_profile.tpl. Is it different now and have you got any leads on a tutorial or more info for this?

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
Theming Guide

A great place to look is the theming guide in the handbook which is at http://drupal.org/theme-guide/6.

If you want to use custom node templates for different content types the setup is similar to drupal 5. If you have a node.tpl.php file that is used. If you have a node-content_type.tpl.php file that is used when the content_type is the machine readable name for your content type. Two things to note. First, you need to have a node.tpl.php file in your theme to have a node-content_type.tpl.php file. Second, when you make certain changes you need to clear the theme registry/cache. You can do this by clicking the clear cache button on the performance page or submitting the modules pages/themes page. There is, also, a function you can put in your theme during dev so you don't have to do this. It will just rebuild on every page load.

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 01/22/2009
Thanks

I've got it going now. It will take me a couple of days to work out the code in the tpl.php and the CSS but I am on the way. This site is so cool and you guys are always great to help.

Thanks

Joined: 01/22/2009
Node done now on to path

I've got the node-content_type.tpl.php done now except for the CSS. Now I want all the nodes of this type to have their own path. I want to do this so that I can disable blocks on those pages. I want the page for these nodes to spread out a bit & having right and left sidebar together on right side (in Marinelli theme) is a bit cramped. Is Pathauto the way to go or is there another way? I don't know how to use arguments with a content type.

Joined: 10/18/2008
Yeah, path auto is the way to

Yeah, path auto is the way to go. Also views.

Create a view called "displaycontenttype" or whatever, then create a page view with the path as "contentpath" and when you're finished with the view you'll be able to display "www.mywebsite.com/contentpath" which will give you all your nodes of that type.

Then in your blocks settings you can forbid that path.

Or in your page.tpl.php you can use an if statement to check the path as well.

/ * Begin Signature */
It's a strange thing about determined seekers-after-wisdom that, no matter where they happen to be, they'll always seek that wisdom which is a long way off. Wisdom is one of the few things that looks bigger the further away it is.

Joined: 01/22/2009
No Views Display - only view with links

Thanks for responding.

The trouble is that I don't want these pages to be in a view with paging. I've got a view with titles that links to them. So I want each page to be freestanding, not be in a view. I guess I could use Pathauto but it is large and I only want to give a path to that one content type.

Joined: 10/18/2008
Oh, then pathauto is the way

Oh, then pathauto is the way to go. You can set up a default path ie "mypath/content" and default naming convention.

/ * Begin Signature */
It's a strange thing about determined seekers-after-wisdom that, no matter where they happen to be, they'll always seek that wisdom which is a long way off. Wisdom is one of the few things that looks bigger the further away it is.

Joined: 01/22/2009
Thanks

Ok, I guess....I'm just looking for alternative ways. This will work.