[themes] How do i theme blog entries by content type?

brendan, fresh-off.com hello at fresh-off.com
Wed Nov 25 18:21:31 UTC 2009


Hello Themers!

 

How do I theme a page based on content type? 
I've got a site with a few different custom pages and separate .tpl.php
files for their custom layouts and CSS/XHTML.  The "Blog" page is a View
with a list of teasers.  How do I create a custom .tpl.php file that only
targets the "page" (and layout) that the individual/full blog entries are
displayed on?

 

The Theme Developer list these as the candidate files:   page-node-#.tpl.php
< page-node.tpl.php < page.tpl.php.  

 

But I don't want to use "page.tpl.php" as its too broad in its reach and  I
may decide to add other pages non-blog pages in the future.  

 

I've tried "page-blog.tpl.php" - but it broke my layout.  I still have some
unresolved CSS/XHTML issues, so I'm wondering if "page-blog.tpl.php" is the
correct  naming convention, but  I just have a few bugs in my code to work
out?

 

 

A second (less important) question: 

Keeping track of all those .tpl.php files is getting confusing!  The Views
pages are easy ("page-blog.tpl.php"  or "page-work.tpl.php"  for example),
but Theme Developer is telling me that for all pages using the "page"
content type, that I have to style them by their ID ("page-node-1.tpl.php"
for the "about" page).  Is there any way to name a .tpl.php file for a page
content type in a more semantic/meaningful way?  

 

Such as "page-contact.tpl.php" instead of "page-node-392.tpl.php"

 

 

Thanks!

 

 

 

 

brendan, fresh-off.com

Creative Direction & Consultation: Web | Print | Brand

 

http://fresh-off.com

hello at fresh-off.com

206.328.1067

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20091125/389385d0/attachment.html 


More information about the themes mailing list