| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: template.php,v 1.17.2.1 2009/02/13 06:47:44 johnalbin Exp $ 3 4 /** 5 * @file 6 * Contains theme override functions and preprocess functions for the theme. 7 * 8 * ABOUT THE TEMPLATE.PHP FILE 9 * 10 * The template.php file is one of the most useful files when creating or 11 * modifying Drupal themes. You can add new regions for block content, modify 12 * or override Drupal's theme functions, intercept or make additional 13 * variables available to your theme, and create custom PHP logic. For more 14 * information, please visit the Theme Developer's Guide on Drupal.org: 15 * http://drupal.org/theme-guide 16 * 17 * OVERRIDING THEME FUNCTIONS 18 * 19 * The Drupal theme system uses special theme functions to generate HTML 20 * output automatically. Often we wish to customize this HTML output. To do 21 * this, we have to override the theme function. You have to first find the 22 * theme function that generates the output, and then "catch" it and modify it 23 * here. The easiest way to do it is to copy the original function in its 24 * entirety and paste it here, changing the prefix from theme_ to STARTERKIT_. 25 * For example: 26 * 27 * original: theme_breadcrumb() 28 * theme override: STARTERKIT_breadcrumb() 29 * 30 * where STARTERKIT is the name of your sub-theme. For example, the 31 * zen_classic theme would define a zen_classic_breadcrumb() function. 32 * 33 * If you would like to override any of the theme functions used in Zen core, 34 * you should first look at how Zen core implements those functions: 35 * theme_breadcrumbs() in zen/template.php 36 * theme_menu_item_link() in zen/template.php 37 * theme_menu_local_tasks() in zen/template.php 38 * 39 * For more information, please visit the Theme Developer's Guide on 40 * Drupal.org: http://drupal.org/node/173880 41 * 42 * CREATE OR MODIFY VARIABLES FOR YOUR THEME 43 * 44 * Each tpl.php template file has several variables which hold various pieces 45 * of content. You can modify those variables (or add new ones) before they 46 * are used in the template files by using preprocess functions. 47 * 48 * This makes THEME_preprocess_HOOK() functions the most powerful functions 49 * available to themers. 50 * 51 * It works by having one preprocess function for each template file or its 52 * derivatives (called template suggestions). For example: 53 * THEME_preprocess_page alters the variables for page.tpl.php 54 * THEME_preprocess_node alters the variables for node.tpl.php or 55 * for node-forum.tpl.php 56 * THEME_preprocess_comment alters the variables for comment.tpl.php 57 * THEME_preprocess_block alters the variables for block.tpl.php 58 * 59 * For more information on preprocess functions and template suggestions, 60 * please visit the Theme Developer's Guide on Drupal.org: 61 * http://drupal.org/node/223440 62 * and http://drupal.org/node/190815#template-suggestions 63 */ 64 65 66 /* 67 * Add any conditional stylesheets you will need for this sub-theme. 68 * 69 * To add stylesheets that ALWAYS need to be included, you should add them to 70 * your .info file instead. Only use this section if you are including 71 * stylesheets based on certain conditions. 72 */ 73 /* -- Delete this line if you want to use and modify this code 74 // Example: optionally add a fixed width CSS file. 75 if (theme_get_setting('STARTERKIT_fixed')) { 76 drupal_add_css(path_to_theme() . '/layout-fixed.css', 'theme', 'all'); 77 } 78 // */ 79 80 81 /** 82 * Implementation of HOOK_theme(). 83 */ 84 function STARTERKIT_theme(&$existing, $type, $theme, $path) { 85 $hooks = zen_theme($existing, $type, $theme, $path); 86 // Add your theme hooks like this: 87 /* 88 $hooks['hook_name_here'] = array( // Details go here ); 89 */ 90 // @TODO: Needs detailed comments. Patches welcome! 91 return $hooks; 92 } 93 94 /** 95 * Override or insert variables into all templates. 96 * 97 * @param $vars 98 * An array of variables to pass to the theme template. 99 * @param $hook 100 * The name of the template being rendered (name of the .tpl.php file.) 101 */ 102 /* -- Delete this line if you want to use this function 103 function STARTERKIT_preprocess(&$vars, $hook) { 104 $vars['sample_variable'] = t('Lorem ipsum.'); 105 } 106 // */ 107 108 /** 109 * Override or insert variables into the page templates. 110 * 111 * @param $vars 112 * An array of variables to pass to the theme template. 113 * @param $hook 114 * The name of the template being rendered ("page" in this case.) 115 */ 116 /* -- Delete this line if you want to use this function 117 function STARTERKIT_preprocess_page(&$vars, $hook) { 118 $vars['sample_variable'] = t('Lorem ipsum.'); 119 } 120 // */ 121 122 /** 123 * Override or insert variables into the node templates. 124 * 125 * @param $vars 126 * An array of variables to pass to the theme template. 127 * @param $hook 128 * The name of the template being rendered ("node" in this case.) 129 */ 130 /* -- Delete this line if you want to use this function 131 function STARTERKIT_preprocess_node(&$vars, $hook) { 132 $vars['sample_variable'] = t('Lorem ipsum.'); 133 } 134 // */ 135 136 /** 137 * Override or insert variables into the comment templates. 138 * 139 * @param $vars 140 * An array of variables to pass to the theme template. 141 * @param $hook 142 * The name of the template being rendered ("comment" in this case.) 143 */ 144 /* -- Delete this line if you want to use this function 145 function STARTERKIT_preprocess_comment(&$vars, $hook) { 146 $vars['sample_variable'] = t('Lorem ipsum.'); 147 } 148 // */ 149 150 /** 151 * Override or insert variables into the block templates. 152 * 153 * @param $vars 154 * An array of variables to pass to the theme template. 155 * @param $hook 156 * The name of the template being rendered ("block" in this case.) 157 */ 158 /* -- Delete this line if you want to use this function 159 function STARTERKIT_preprocess_block(&$vars, $hook) { 160 $vars['sample_variable'] = t('Lorem ipsum.'); 161 } 162 // */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |