Web server iis - 170 CHAPTER 5 ADDING AND CUSTOMIZING THEMES

170 CHAPTER 5 ADDING AND CUSTOMIZING THEMES

Most notable is the $contentvariable, which contains the main feature of the page a node, a user, a list of taxonomy terms, or any other content. The template ends by printing the $closurevariable directly before the closing tag: This is necessary to guarantee that modules have a chance to insert scripts at the bottom of the page. This is usually done in cases where the loading order of a script needs to be controlled; scripts at the bottom of the page will load after scripts earlier on the page, such as those needed for transforming text areas into WYSIWYG editors. Passing Extra Variables to Templates The variables listed for each of the previous tpl.php template files are all you need to support the normal functioning of your Drupal site. In case you would like to push other information into the template files, there is a mechanism for adding variables. The following function must be added to a file named template.php in your theme s directory: function _phptemplate_variables($hook, $vars) { … return $vars; } For Bluemarine, this would be in the file themes/bluemarine/template.php. The $hook variable is the name of the themable function being called and subsequently the root of the name of the template file to which the variables are headed. The $vars variable is an associative array containing the default variables as described in the preceding section. Thus, when the theme(’block’) function is called, _phptemplate_variables will also be called with the parameters ‘block’ and an array of the variables associated with the block.tpl.phptemplate: $block, $id, $block_id, $zebra, $block_zebra, and $is_front. At this point, you have the chance to add values to the array, or even change those that are already inside it. The $vars array that you return will determine which variables are visible to the block.tpl.php file. The same is true for each of the default tpl.php files, as well as any other template files that you may have added, such as node-type-specific files or overrides of themable functions. Exercise 5-2 demonstrates how to pass extra variables to a template.
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Leave a Reply