| 1 |
<?php
|
| 2 |
|
| 3 |
// $Id: template.php,v 1.1.2.2 2006/05/19 01:14:09 kencollins Exp $
|
| 4 |
|
| 5 |
/**
|
| 6 |
* I need the 'drupal.js' file on every page to use it. I had first tried:
|
| 7 |
* drupal_set_html_head('<script type="text/javascript" src="misc/drupal.js"></script>');
|
| 8 |
* But that duplicated resuts on some pages. Now I am just using this.
|
| 9 |
*/
|
| 10 |
|
| 11 |
drupal_add_js('misc/drupal.js');
|
| 12 |
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Catch the theme_image_gallery function, redirect through the template api
|
| 16 |
* and point Drupal to the "image_gallery.tpl.php" file to determine the layout
|
| 17 |
* of your image gallery pages.
|
| 18 |
*/
|
| 19 |
|
| 20 |
function phptemplate_image_gallery($galleries, $images) {
|
| 21 |
return _phptemplate_callback('image_gallery', array('galleries' => $galleries, 'images' => $images));
|
| 22 |
}
|
| 23 |
|
| 24 |
|
| 25 |
/**
|
| 26 |
* Catch the theme_status_messages function in "includes/theme.inc", and output
|
| 27 |
* directly from template.php. Restyling this a bit to work with the FAT js function
|
| 28 |
* and I've even added an if else so that we can style 'error' differently from 'status'.
|
| 29 |
*/
|
| 30 |
|
| 31 |
function phptemplate_status_messages() {
|
| 32 |
if ($data = drupal_get_messages()) {
|
| 33 |
$output = '';
|
| 34 |
foreach ($data as $type => $messages) {
|
| 35 |
if ($type == 'error') {
|
| 36 |
$output .= "<br />\n<div id=\"content-message\" class=\"messages error fade-ffde00\">\n";
|
| 37 |
}
|
| 38 |
else if ($type == 'status') {
|
| 39 |
$output .= "<br />\n<div id=\"content-message\" class=\"messages status fade-78ff00\">\n";
|
| 40 |
}
|
| 41 |
if (count($messages) > 1) {
|
| 42 |
$output .= " <ul>\n";
|
| 43 |
foreach($messages as $message) {
|
| 44 |
$output .= ' <li>'. $message ."</li>\n";
|
| 45 |
}
|
| 46 |
$output .= " </ul>\n";
|
| 47 |
}
|
| 48 |
else {
|
| 49 |
$output .= $messages[0];
|
| 50 |
}
|
| 51 |
$output .= "</div>\n";
|
| 52 |
}
|
| 53 |
return $output;
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
| 57 |
|
| 58 |
/**
|
| 59 |
* Catch the theme_maintenance_page function in "includes/theme.inc", and redirect
|
| 60 |
* through the template api and point Drupal to the "maintenance_page.tpl.php" file
|
| 61 |
# to style the 503 Service Unavailable page when the site is offline. The phptemplate
|
| 62 |
* variables function is used to get the $stie_name variable used on the page template.
|
| 63 |
*/
|
| 64 |
|
| 65 |
function phptemplate_maintenance_page($content) {
|
| 66 |
return _phptemplate_callback('maintenance_page', array('content' => $content));
|
| 67 |
}
|
| 68 |
|
| 69 |
function _phptemplate_variables($hook, $vars) {
|
| 70 |
switch($hook) {
|
| 71 |
case 'maintenance_page' :
|
| 72 |
$vars['site_name'] = variable_get('site_name', '') ;
|
| 73 |
break;
|
| 74 |
}
|
| 75 |
return $vars;
|
| 76 |
}
|
| 77 |
|
| 78 |
|
| 79 |
/**
|
| 80 |
* Catch the theme_comment_thread_expanded function in "modules/comment.module", and output
|
| 81 |
* directly from template.php. I have added some logic that will set the maximum indentation
|
| 82 |
* at 9 levels deep. I have also reduced the indentation from Drupal's 25px to 15px. I think
|
| 83 |
* the combination of these two helps keep things looking clean. If you want to change that
|
| 84 |
* maximum depth indentation on the 3rd line, do not forget to also take what ever number you
|
| 85 |
* enter in there and multiple it by 15 and enter that value into the else's margin-left
|
| 86 |
* inline pixel declaration too.
|
| 87 |
*/
|
| 88 |
|
| 89 |
function phptemplate_comment_thread_expanded($comment) {
|
| 90 |
$output = '';
|
| 91 |
if ($comment->depth <= 9) {
|
| 92 |
$output .= "<div class=\"comment-box_indent\" style=\"margin-left:". ($comment->depth * 15) ."px;\">\n";
|
| 93 |
}
|
| 94 |
else {
|
| 95 |
$output .= "<div class=\"comment-box_indent\" style=\"margin-left: 135px\">\n";
|
| 96 |
}
|
| 97 |
$output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
|
| 98 |
$output .= "</div>\n";
|
| 99 |
return $output;
|
| 100 |
}
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
?>
|