template.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Sets the body-tag class attribute.
  4. *
  5. * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
  6. */
  7. function phptemplate_body_class($sidebar_left, $sidebar_right) {
  8. if ($sidebar_left != '' && $sidebar_right != '') {
  9. $class = 'sidebars';
  10. }
  11. else {
  12. if ($sidebar_left != '') {
  13. $class = 'sidebar-left';
  14. }
  15. if ($sidebar_right != '') {
  16. $class = 'sidebar-right';
  17. }
  18. }
  19. if (isset($class)) {
  20. print ' class="'. $class .'"';
  21. }
  22. }
  23. /**
  24. * Return a themed breadcrumb trail.
  25. *
  26. * @param $breadcrumb
  27. * An array containing the breadcrumb links.
  28. * @return a string containing the breadcrumb output.
  29. */
  30. function phptemplate_breadcrumb($breadcrumb) {
  31. if (!empty($breadcrumb)) {
  32. return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  33. }
  34. }
  35. /**
  36. * Allow themable wrapping of all comments.
  37. */
  38. function phptemplate_comment_wrapper($content, $type = null) {
  39. static $node_type;
  40. if (isset($type)) $node_type = $type;
  41. if (!$content || $node_type == 'forum') {
  42. return '<div id="comments">'. $content . '</div>';
  43. }
  44. else {
  45. return '<div id="comments"><h2 class="comments">Comments</h2>'. $content .'</div>';
  46. }
  47. }
  48. /**
  49. * Override or insert PHPTemplate variables into the templates.
  50. */
  51. function _phptemplate_variables($hook, $vars) {
  52. if ($hook == 'page') {
  53. if ($secondary = menu_secondary_local_tasks()) {
  54. $output = '<span class="clear"></span>';
  55. $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
  56. $vars['tabs2'] = $output;
  57. }
  58. // Hook into color.module
  59. if (module_exist('color')) {
  60. _color_page_alter($vars);
  61. }
  62. return $vars;
  63. }
  64. return array();
  65. }
  66. /**
  67. * Returns the rendered local tasks. The default implementation renders
  68. * them as tabs.
  69. *
  70. * @ingroup themeable
  71. */
  72. function phptemplate_menu_local_tasks() {
  73. $output = '';
  74. if ($primary = menu_primary_local_tasks()) {
  75. $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
  76. }
  77. return $output;
  78. }