[themes] How To Theme Teaser Apart From Nodes

Joon Park dvessel at gmail.com
Tue Jun 27 00:42:23 UTC 2006


Your 90% there then knowing css. You don't need a custom .tpl file.  
That's only useful when you want to get elaborate with different  
types of nodes. Teasers and the full node use the same template.

Just try this. Inside your node.tpl.php file, look for the outter  
most container. Most likely a <div..

Add this in there:

   <div class="node<?php if($teaser) { echo ' node-teaser'; } ?>">

     ...your.stuff...

   </div>

When it's in teaser form then it will print out:

   <div class="node node-teaser">

     ...your.stuff...

   </div>

Pretty straight forward I think. You should be able to take it from  
there with a selector..

   .node-teaser .title {
     ...
   }


Take care,

––––---——_–joon park ——----––––
    http://www.dvessel.com
––––---—\\—————————————----––––


On Jun 26, 2006, at 8:29 PM, Will Evans wrote:

> Hi Joon,
>
> Thanks for sending this and taking the time to reply.  I might be a  
> bit out of my league here, I'm very familiar with CSS once I get to  
> that point. I understand that I need to create a custom .tpl file  
> although I'm not sure the best way to go about that.
>
> Would I include what you described below in the node.tpl.php file  
> or start from scratch. I'm assuming that I would the teaser in a  
> <div> tag and go from there?
>
> Thanks,
>
> Will
>
> On Jun 26, 2006, at 8:08 PM, Joon Park wrote:
>
>> Hi, been lurking here for a while. My first post. :)
>>
>> You could just check if the $teaser variable returns anything and  
>> have it spit out anything inside the conditional statement.
>>
>> <?php if($teaser) { ?>
>>   <p>I'm a teaser.</p>
>> <?php } ?>
>>
>> I'm doing something similar but it's set to a class then I can  
>> control it from my style sheet.
>>
>> You can read about it here.
>>
>> http://www.dvessel.com/node/87
>>
>> It covers a few more things too.
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20060627/c8bf5736/attachment.htm


More information about the themes mailing list