[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/themes/garland/ -> template.php (source)

   1  <?php
   2  
   3  /**
   4   * Sets the body-tag class attribute.
   5   *
   6   * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
   7   */
   8  function phptemplate_body_class($left, $right) {
   9    if ($left != '' && $right != '') {
  10      $class = 'sidebars';
  11    }
  12    else {
  13      if ($left != '') {
  14        $class = 'sidebar-left';
  15      }
  16      if ($right != '') {
  17        $class = 'sidebar-right';
  18      }
  19    }
  20  
  21    if (isset($class)) {
  22      print ' class="'. $class .'"';
  23    }
  24  }
  25  
  26  /**
  27   * Return a themed breadcrumb trail.
  28   *
  29   * @param $breadcrumb
  30   *   An array containing the breadcrumb links.
  31   * @return a string containing the breadcrumb output.
  32   */
  33  function phptemplate_breadcrumb($breadcrumb) {
  34    if (!empty($breadcrumb)) {
  35      return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  36    }
  37  }
  38  
  39  /**
  40   * Override or insert PHPTemplate variables into the templates.
  41   */
  42  function phptemplate_preprocess_page(&$vars) {
  43    $vars['tabs2'] = menu_secondary_local_tasks();
  44  
  45    // Hook into color.module
  46    if (module_exists('color')) {
  47      _color_page_alter($vars);
  48    }
  49  }
  50  
  51  /**
  52   * Add a "Comments" heading above comments except on forum pages.
  53   */
  54  function garland_preprocess_comment_wrapper(&$vars) {
  55    if ($vars['content'] && $vars['node']->type != 'forum') {
  56      $vars['content'] = '<h2 class="comments">'. t('Comments') .'</h2>'.  $vars['content'];
  57    }
  58  }
  59  
  60  /**
  61   * Returns the rendered local tasks. The default implementation renders
  62   * them as tabs. Overridden to split the secondary tasks.
  63   *
  64   * @ingroup themeable
  65   */
  66  function phptemplate_menu_local_tasks() {
  67    return menu_primary_local_tasks();
  68  }
  69  
  70  /**
  71   * Returns the themed submitted-by string for the comment.
  72   */
  73  function phptemplate_comment_submitted($comment) {
  74    return t('!datetime — !username',
  75      array(
  76        '!username' => theme('username', $comment),
  77        '!datetime' => format_date($comment->timestamp)
  78      ));
  79  }
  80  
  81  /**
  82   * Returns the themed submitted-by string for the node.
  83   */
  84  function phptemplate_node_submitted($node) {
  85    return t('!datetime — !username',
  86      array(
  87        '!username' => theme('username', $node),
  88        '!datetime' => format_date($node->created),
  89      ));
  90  }
  91  
  92  /**
  93   * Generates IE CSS links for LTR and RTL languages.
  94   */
  95  function phptemplate_get_ie_styles() {
  96    global $language;
  97  
  98    $iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />';
  99    if ($language->direction == LANGUAGE_RTL) {
 100      $iecss .= '<style type="text/css" media="all">@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";</style>';
 101    }
 102  
 103    return $iecss;
 104  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7