PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/templates/template_default/common/html_header.php

https://github.com/ZenMagick/zc-base
PHP | 129 lines | 71 code | 10 blank | 48 comment | 13 complexity | e0c010e4cc3f66aef0be2a06e8256594 MD5 | raw file
  1. <?php
  2. /**
  3. * Common Template
  4. *
  5. * outputs the html header. i,e, everything that comes before the \</head\> tag <br />
  6. *
  7. * @package templateSystem
  8. * @copyright Copyright 2003-2010 Zen Cart Development Team
  9. * @copyright Portions Copyright 2003 osCommerce
  10. * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  11. * @version $Id: html_header.php 15761 2010-03-31 19:31:27Z drbyte $
  12. */
  13. /**
  14. * load the module for generating page meta-tags
  15. */
  16. require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php'));
  17. /**
  18. * output main page HEAD tag and related headers/meta-tags, etc
  19. */
  20. ?>
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  22. <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
  23. <head>
  24. <title><?php echo META_TAG_TITLE; ?></title>
  25. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
  26. <meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" />
  27. <meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" />
  28. <meta http-equiv="imagetoolbar" content="no" />
  29. <meta name="author" content="The Zen Cart&trade; Team and others" />
  30. <meta name="generator" content="shopping cart program by Zen Cart&trade;, http://www.zen-cart.com eCommerce" />
  31. <?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance' || $robotsNoIndex === true) { ?>
  32. <meta name="robots" content="noindex, nofollow" />
  33. <?php } ?>
  34. <?php if (defined('FAVICON')) { ?>
  35. <link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
  36. <link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
  37. <?php } //endif FAVICON ?>
  38. <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
  39. <?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
  40. <link rel="canonical" href="<?php echo $canonicalLink; ?>" />
  41. <?php } ?>
  42. <?php
  43. /**
  44. * load all template-specific stylesheets, named like "style*.css", alphabetically
  45. */
  46. $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');
  47. while(list ($key, $value) = each($directory_array)) {
  48. echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
  49. }
  50. /**
  51. * load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
  52. */
  53. $manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
  54. $tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
  55. $tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
  56. if ($current_page_base == 'page' && isset($ezpage_id)) $tmp_pagename = $current_page_base . (int)$ezpage_id;
  57. $sheets_array = array('/' . $_SESSION['language'] . '_stylesheet',
  58. '/' . $tmp_pagename,
  59. '/' . $_SESSION['language'] . '_' . $tmp_pagename,
  60. '/c_' . $cPath,
  61. '/' . $_SESSION['language'] . '_c_' . $cPath,
  62. '/m_' . $manufacturers_id,
  63. '/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id,
  64. '/p_' . $tmp_products_id,
  65. '/' . $_SESSION['language'] . '_p_' . $tmp_products_id
  66. );
  67. while(list ($key, $value) = each($sheets_array)) {
  68. //echo "<!--looking for: $value-->\n";
  69. $perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
  70. if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
  71. }
  72. /**
  73. * load printer-friendly stylesheets -- named like "print*.css", alphabetically
  74. */
  75. $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^print/', '.css');
  76. sort($directory_array);
  77. while(list ($key, $value) = each($directory_array)) {
  78. echo '<link rel="stylesheet" type="text/css" media="print" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
  79. }
  80. /**
  81. * load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
  82. */
  83. $directory_array = $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.js');
  84. while(list ($key, $value) = each($directory_array)) {
  85. echo '<script type="text/javascript" src="' . $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value . '"></script>'."\n";
  86. }
  87. /**
  88. * load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically
  89. */
  90. $directory_array = $template->get_template_part($page_directory, '/^jscript_/', '.js');
  91. while(list ($key, $value) = each($directory_array)) {
  92. echo '<script type="text/javascript" src="' . $page_directory . '/' . $value . '"></script>' . "\n";
  93. }
  94. /**
  95. * load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
  96. */
  97. $directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php');
  98. while(list ($key, $value) = each($directory_array)) {
  99. /**
  100. * include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
  101. * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
  102. */
  103. require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value); echo "\n";
  104. }
  105. /**
  106. * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
  107. */
  108. $directory_array = $template->get_template_part($page_directory, '/^jscript_/');
  109. while(list ($key, $value) = each($directory_array)) {
  110. /**
  111. * include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
  112. * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
  113. */
  114. require($page_directory . '/' . $value); echo "\n";
  115. }
  116. // DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
  117. ?>
  118. </head>
  119. <?php // NOTE: Blank line following is intended: ?>