Advertisement
Guest User

template.tpl

a guest
Jan 28th, 2013
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <?php
  2. // $Id: template.php,v 1.2 2009/08/17 08:40:53 cignex Exp $
  3.  
  4. /**
  5. * Sets the body-tag class attribute.
  6. *
  7. * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
  8. */
  9. function phptemplate_body_class($left, $right) {
  10. if ($left != '' && $right != '') {
  11. $class = 'sidebars';
  12. }
  13. else {
  14. if ($left != '') {
  15. $class = 'sidebar-left';
  16. }
  17. if ($right != '') {
  18. $class = 'sidebar-right';
  19. }
  20. }
  21.  
  22. if (isset($class)) {
  23. print ' class="mainbody '. $class .'"';
  24. }
  25. }
  26.  
  27. /**
  28. * Return a themed breadcrumb trail.
  29. *
  30. * @param $breadcrumb
  31. * An array containing the breadcrumb links.
  32. * @return a string containing the breadcrumb output.
  33. */
  34. function phptemplate_breadcrumb($breadcrumb) {
  35. if (!empty($breadcrumb)) {
  36. return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  37. }
  38. }
  39.  
  40. /**
  41. * Allow themable wrapping of all comments.
  42. */
  43. function phptemplate_comment_wrapper($content, $node) {
  44. if (!$content || $node->type == 'forum') {
  45. return '<div id="comments">'. $content .'</div>';
  46. }
  47. else {
  48. return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
  49. }
  50. }
  51.  
  52. /**
  53. * Override or insert PHPTemplate variables into the templates.
  54. */
  55. function phptemplate_preprocess_page(&$vars) {
  56. $vars['tabs2'] = menu_secondary_local_tasks();
  57.  
  58. $vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
  59.  
  60. // Hook into color.module
  61. if (module_exists('color')) {
  62. _color_page_alter($vars);
  63. }
  64. }
  65.  
  66. /**
  67. * Returns the rendered local tasks. The default implementation renders
  68. * them as tabs. Overridden to split the secondary tasks.
  69. *
  70. * @ingroup themeable
  71. */
  72. function phptemplate_menu_local_tasks() {
  73. return menu_primary_local_tasks();
  74. }
  75.  
  76. function phptemplate_comment_submitted($comment) {
  77. return t('!datetime — !username',
  78. array(
  79. '!username' => theme('username', $comment),
  80. '!datetime' => format_date($comment->timestamp)
  81. ));
  82. }
  83.  
  84. function phptemplate_node_submitted($node) {
  85. return t('!datetime — !username',
  86. array(
  87. '!username' => theme('username', $node),
  88. '!datetime' => format_date($node->created),
  89. ));
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement