/[drupal]/contributions/modules/node_style/node_style.inc
ViewVC logotype

Contents of /contributions/modules/node_style/node_style.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Feb 7 16:58:44 2007 UTC (2 years, 9 months ago) by karthik
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +30 -1 lines
File MIME type: text/x-php
port: Ease the process of merging multiple _phptemplate_variables functions.
Add documentation.
Fix URL in README.txt.
1 <?php
2 // $Id: node_style.inc,v 1.1 2006/04/29 08:38:38 karthik Exp $
3
4 /**
5 * _phptemplate_variables function from the phptemplate engine. If the theme is
6 * already using this function, the two instances will need to be merged
7 * manually.
8 *
9 * Due to the fact that conflicts can exist with this function, try working
10 * around it with as much of a minimal hack as possible. The user will have to
11 * a) Rename the conflicting function to _phptemplate_variables_theme_key(),
12 * for e.g., _phptemplate_variables_garland().
13 * b) Ensure that this function is in the template.php file of the theme's
14 * directory.
15 * c) If two themes (like Garland and Minnelli) both share the same
16 * _phptemplate_variables function, then a duplicate will have to be made
17 * for each. Or in other words, in the case of Garland and Minnelli, there
18 * should be two functions - _phptemplate_variables_garland() and
19 * _phptemplate_variables_minnelli().
20 */
21 function _phptemplate_variables($hook, $variables) {
22 static $included = FALSE;
23
24 if (!$included && !empty($variables['directory'])) {
25 $file = $variables['directory'] .'/template.php';
26 if (file_exists($file)) {
27 include_once $file;
28 $function = '_phptemplate_variables_'. $GLOBALS['theme_key'];
29 if (function_exists($function)) {
30 $included = TRUE;
31 }
32 }
33 }
34 if ($included) {
35 $function = '_phptemplate_variables_'. $GLOBALS['theme_key'];
36 $variables = $function($hook, $variables);
37 }
38
39 return node_style_return_vars($hook, $variables);
40 }

  ViewVC Help
Powered by ViewVC 1.1.2