theme

call template file, pass variables

  1. <?php
  2.  
  3. $text = theme('apply_template', $data);
  4. return $text;
  5.  
  6. function theme_apply_template($data) {
  7.     ob_start();
  8.     include path_to_theme().'/my-block.tpl.php';

Example of avoiding $content and themeing $node sectins directly

  1. <div class="node<?php print ($sticky) ? " sticky" : ""; ?> blog">
  2.   <?php if ($page == 0): ?>
  3.   <h1 class="title"><a href="<?php print $node_url ?>" title="<?php print $title

Fix for Customizing pager

  1. function zen_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
  2.   global $pager_total;
  3.   $output = '';
  4.  
  5.   if ($pager_total[$element] > 1) {

Customizing pager

  1. function zen_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
  2.   global $pager_total;
  3.   $output = '';
  4.  
  5.   if ($pager_total[$element] > 1) {

relative date in comments

  1. function tassoman_comment_view($comment, $links = array(), $visible = 1) {
  2.   static $first_new = TRUE;
  3.        
  4.         // comment time difference
  5.         static $comment_previous_timestamp;

custom node template

  1.  <div class="content">
  2.         <?php print content_format('field_buildings_img', $field_buildings_img[0]); ?>
  3.         <?php print check_markup($node->content['body']['#value']) ?>
  4.        

Fix for overriding favorite nodes links

  1. function phptemplate_links($links, $attributes = array('class' => 'links')) {
  2.   $output = '';
  3.  
  4.   if (count($links) > 0) {
  5.     $output = '<ul'. drupal_attributes($attributes) .'>';

Fix for overriding favorite nodes links

  1. function phptemplate_links($links, $attributes = array('class' => 'links')) {
  2.   $output = '';
  3.  
  4.   if (count($links) > 0) {
  5.     $output = '<ul'. drupal_attributes($attributes) .'>';

Fix for overriding favorite nodes links

  1. function phptemplate_links($links, $attributes = array('class' => 'links')) {
  2.   $output = '';
  3.  
  4.   if (count($links) > 0) {
  5.     $output = '<ul'. drupal_attributes($attributes) .'>';

Fix for Replace theme functions in live code.

  1. /**
  2.  * Clever hack to hide display of blocks during wizard.
  3.  *
  4.  * The wizard installation tries to keep things as simple and uncluttered
  5.  * as possible, making basic use of the menus and forms.
  6.  
Syndicate content