html.pre.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. if (module_exists('rdf')) {
  3. $vars['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
  4. $vars['rdf_profile'] = ' profile="' . $vars['grddl_profile'] . '"';
  5. }
  6. else {
  7. $vars['doctype'] = '<!DOCTYPE html>' . "\n";
  8. $vars['rdf_profile'] = '';
  9. }
  10. # Add mobile meta tags to $head ADD this to your subtheme
  11. $heads = array();
  12. $heads['HandheldFriendly'] = array(
  13. '#tag' => 'meta',
  14. '#attributes' => array(
  15. 'name' => 'HandheldFriendly',
  16. 'content' => 'true',
  17. ),
  18. );
  19. # Mobile Viewport Fix
  20. # j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
  21. # device-width : Occupy full width of the screen in its current orientation
  22. # initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
  23. # maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
  24. $heads['viewport'] = array(
  25. '#tag' => 'meta',
  26. '#attributes' => array(
  27. 'name' => 'viewport',
  28. 'content' => 'width=device-width,initial-scale=1',
  29. ),
  30. );
  31. # Add these icons links to your sub theme
  32. # or Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references
  33. // $head[] = '<link rel="apple-touch-icon" sizes="72x72" href="'. base_path() . path_to_theme() .'/touch-icon-ipad.png'.'"/>' . "\n";
  34. // $head[] = '<link rel="apple-touch-icon" sizes="114x114" href="'. base_path() . path_to_theme() .'/touch-icon-iphone4.png'.'"/>' . "\n";
  35. $heads['icon'] = array(
  36. '#tag' => 'link',
  37. '#attributes' => array(
  38. 'href' => base_path() . path_to_theme() .'/perf-art.ico',
  39. 'rel' => 'shortcut icon',
  40. // 'type' => 'image/png',
  41. ),
  42. );
  43. $heads['apple-touch-icon'] = array(
  44. '#tag' => 'link',
  45. '#attributes' => array(
  46. 'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
  47. 'rel' => 'apple-touch-icon',
  48. ),
  49. );
  50. foreach ($heads as $type=>$head)
  51. drupal_add_html_head($head, $type);
  52. // $vars['head'] = implode('', $head);
  53. # add body classes
  54. if(isset($vars['node'])){
  55. # from taxonomy
  56. foreach ($vars['node']->taxonomy as $tid => $term) {
  57. $vars['classes_array'][] = 'term-vid-'. $term->vid .' term-tid-'. $tid;
  58. }
  59. # from menu
  60. $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", 'node/'. $vars['node']->nid));
  61. // Now get the menu related information.
  62. if (!empty($mlid) || !empty($node->menu['mlid']) || !empty($node->menu['plid'])) {
  63. $menu_link = menu_link_load($mlid);
  64. // krumo($menu_link);
  65. $vars['classes_array'][] = ' mlid-'. $menu_link['mlid'] .' plid-'. $menu_link['plid'];
  66. }
  67. }
  68. # theme layout settings
  69. if(isset($vars['page']['sidebar_first']) && isset($vars['page']['sidebar_second'])){
  70. $layout = 'two-sidebars';
  71. }else if(isset($vars['page']['sidebar_first']) || isset($vars['page']['sidebar_second'])){
  72. $layout = isset($vars['page']['sidebar_first']) ? 'sidebar-first' : 'sidebar-second';
  73. }else{
  74. $layout = 'no-sidebar';
  75. }
  76. $vars['classes_array'][] = $layout;
  77. if (theme_get_setting('layout_enable_settings') == 'on') {
  78. $method = theme_get_setting('layout_method');
  79. $vars['method'] = $method;
  80. $vars['classes_array'][] .= ' layout-method-'.$method;
  81. }