[themes] How do i theme blog entries by content type?
sebastian
inforazor at gmail.com
Wed Nov 25 18:34:36 UTC 2009
Hi Brendan,
1. If you are using pathauto, or url names that are more legible than
node/47 etc. then you should also get better theme template suggestions.
Make sure that you are linking to the page by its human-name, not its ID
number.
Some possible other solutions:
2. User devel to find the $node->type variable, and populate that in one
of your div tags id or class name at a high enough level, that you can
then detect and then theme just that page (or group of pages by type),
this would be done in your main page.tpl.php [and then you don't even
need a separate tpl.php files...]
3. Use Views to make a blog view that you like, and then you can theme
just that View [with however many 'pages' you make of that view as
daughters]
4. Use Panels with Views, and then theme on the Panels level.
I'm sure there are others I am forgetting [there is always more than 4
ways to skin a...]
brendan, fresh-off.com wrote:
> *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 <mailto:hello at fresh-off.com>
>
> 206.328.1067
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
More information about the themes
mailing list