rendered paste body<?php
// Celju -- $Id: template.php,v 1.1.4.1 2008/01/10 01:53:44 jwolf Exp $
drupal_rebuild_theme_registry();
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' :: ', $breadcrumb) .'</div>';
}
}
function celju_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$output = '<ul'. drupal_attributes($attributes) .'>';
$num_links = count($links);
$i = 1;
foreach ($links as $key => $link) {
$class = $key;
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class .= ' first';
}
if ($i == $num_links) {
$class .= ' last';
}
if (isset($link['href']) && $link['href'] == $_GET['q']) {
$class .= ' active';
}
$output .= '<li class="'. $class .'">';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .= l('<span>xyz</span>'.$link['title'].'<h1>dada</h1>', $link['href'], $link);
}
else if (!empty($link['title'])) {
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$span_attributes = '';
if (isset($link['attributes'])) {
$span_attributes = drupal_attributes($link['attributes']);
}
$output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
}
$i++;
$output .= "</li>\n";
}
$output .= '</ul>';
}
return $output;
}
function celju_menu_links($links) {
if (!count($links)) {
return '';
}
$level_tmp = explode('-', key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-$level\">\n";
foreach ($links as $index => $link) {
$output .= '<li';
if (stristr($index, 'active')) {
$output .= ' class="active"';
}
$output .= ">". l('<span>'.$link['title'].'</span>', $link['href'], $link['attributes'], $link['query'], $link['fragment'], $absolute, $html = TRUE) ."</li>\n";
}
$output .= '</ul>';
return $output;
}
/**
* Different Node Templates by Node Variables (nid, type, view)
* http://chapterthreellc.com/blog/zirafa/different_node_templates_node_variables_nid_type_view
*/
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'node':
if ($vars['page']) {
$vars['template_files'] = array('node-default-page', 'node-'. $vars['node']->type .'-page', 'node-'. $vars['node']->nid .'-page');
}
else {
$vars['template_files'] = array('node-'. $vars['node']->nid);
}
break;
}
return $vars;
}
/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;
if (!$content || $node_type == 'forum') {
return '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}
/**
* Fix TinyMCE
* removes grey sidebars in text area
*/
function phptemplate_tinymce_theme($init, $textarea_name, $theme_name) {
if (isset($init)) {
switch ($theme_name) {
case 'advanced':
$init['width'] = '100%';
break;
}
}
return $init;
}