You are hereTemplates
Templates
Webform mail template override - total customization
I wanted to make a override of webform mail template, so I can send custom data to paying and non paying partners on my site. As I am using ZEN subtheme, I need to put all the the template in obviously template folder of subtheme, not a root one. Find a default template file in webform module webform-mail.tpl.php and make it something like webform-mail-174.tpl.php, 174 being a nid of your webform. So in order to make this override work. You also need to choose carefully in your webform UI.
Drupal 7 imagecache, theming images in templates
Creating images in your templates in drupal 7 is somewhat different, so here is the code
$hero_image = array(
'style_name' => 'case_study_teaser',
'path' => $image['uri'],
'width' => '',
'height' => '',
'alt' => $image['alt'],
'title' => $image['title'],
);
print theme('image_style',$hero_image);
$img_url = 'public://myimagefolder/imgfilename.jpg'; // the orig image uri
$style = 'thumbnail'; // or any other custom image style you've created via /admin/config/media/image-styles
?>
Translating taxonomy summary in views
Here is another drupal i18n beast. I have nice taxonomy summary for a category of shops. Which is attachment for a view, which passes term to it to filter category and show only shops that are in that category. Looks nice, it is moderately useful and seems it has never been done before. Search for something similar never came up in google, only a rather useful post that deals with similar stuff, only much simpler, people want to translate term title.
Microdata and Fivestar
Microformats are going to be big, they are big even today. Drupal is caching up but modules don't work properly. First thing you would probably do is ratings/review formating. You can try with microformat and fivestar module but it will not work properly. So I themed the fivestar summary function differently and added few lines and not it works and you can check it with google tool
http://www.google.com/webmasters/tools/richsnippets
Just copy this to your template.php or use some diff tool to see what is different
http://www.quickdiff.com/
Drupal 6 to drupal 7 migration tips
However you choose to do a migration from drupal 6 to drupal 7 if you have any complexity in your site it is going to be ugly. Lots of errors and leaps of faith :-).
I choose to do it with drush. So after the drush made what it could do. I tested the site. Not working at all, not even logging in possible. What I did is:
Custom Token and languages for titles and labels
As views and even more panels are not perfect when it comes to translations if you need to have some fixed label with translation for some view/panel. You can create custom token for it and then just translate it over translation interface. Token creation is simple, just use this guide
1. Go to Admin > Structure > Custom Token, click on Add Token
2. Enter a Token Name and Description
3. Choose "Custom Tokens" for the Token Type or "Nodes Token" if you want it to be available on for example node panels overide.
4. In the PHP Replacement text area enter something like this:
Microdata for voteing modules
Well the year is 2012 and you must use microdata, there is a microdata module for drupal 7, but if you are still at drupal 6 you will need to customize. I have been using vote up/down module for my ratings so I needed to change template file of the module to add this microformats to node display so I added this code at the end of widget.tpl.php
// Output of microdata snnipet for ratings
$node=node_load($content_id);
$title = $node->title;
?>
Tracing available variables in template file
I often forget this one, if you need to see what available variables are in some specific template file of any contributed module you will write this on top of the tpl file
and will get a nice list of variables you can use.
Override “Submitted by” text for Drupal nodes?
This is the code you put in your template when overriding submitted by text, there is also a module that helps do some of this things http://drupal.org/project/submitted_by
also take a note that when you want to translate you need to use setting.php technique.
http://drupal.org/node/134002
return t('Some text about sumbiting !username on @datetime',
array(
'!username' => theme('username', $node),
'@datetime' => format_date($node->created),
));
}
CSS in IE8 list tag(LI) in one row
I just encontured stupid problem with IE and listing LI tags in one a row, If you want to list them properly and not skip into second you need to add some
white-space: no-wrap; to work to LI or in fact A tag inside LI. Those having that problem will know what I am talking about.