4.4 Html.tpl.php文件

龶龳龲龯龬龫龨Firebug龙龗龓龒龐龏龋龉龈龅龃齿齾齻齷龫齵齲齯齭齩齨齥龫龐龏齭龫齡齠齵齭齞齚齙齘龐齖齔齐龫齍齋齉齅齵齲齂齀鼾鼺龫鼶p鼰鼯鼫齉齅鼩鼥龳龲齵鼡鼝鼛龯龬鼚鼯鼫齉齅鼖鼔龫鼒鼐鼩

鼌Drupal齡齠龫鼃鼀黽鼀黹黷黵黱黰黭鼯鼫黩黧龫黦黤鼩黠黟鼡鼝黛黙龳齂默黗齿鼯鼫黩黧鼩鼯鼫黩黧齿黖黛鼛鼯鼫龙黔黓黒龫黑黐黍黊黈黇齖齐龫黅黁麾麼龫麹齅鼩齲齯齭麷黖麳麯麹龫Word齵麥齭龳黓黖麳龳麡麞麚龫麙麖麔麒齅麑麍鼩龨鼥麡麙麖龙齞麷黖黭麋黑黐黍齵麊麈麇黖麆麃龫麂鼾黊黈鼩鼯鼫黩黧龫麁鹾鹺鹸鼚鼥麡麳鹶鹳鹰齖麚鼩龃齿鼥鹯麷黖龫黑黐黍齿鼯鼫龏鹭鼩龨Drupal7龙鹪鹩龫鼯鼫黩黧齿PHPTemplate鼩

鼚鹗鹔龫HTML鹌黁鼯鼫鹈鹇龫齿齵齭鼾齂鹆龫Drupal齡齠鹂龙鹂鸿麋鸾鸼龫齉齅鼩鸺鸸Drupal鸶鹔龨鸵鸱鸮龶鸭鸬龳麡龋龉龫齻鸪鸧鹰鸣黵鹇齻鸟鹆鸜鸚麡齉齅鼩

鸘鸖黙黛齭龨鸓鹾Drupal齡齠龫齻鸪齵齭麈鸐鸍龫鼚tpl.php齉齅鸆鸅鸄鼩鸂鼡鼝黟黛鷿鷿html.tpl.php鼥麡齉齅齵齭麈鷻鷸鼥麡齉齅齿鷶HTML鷳鷱鸸齡鸖龫鼩

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"
  <?php print $rdf_namespaces; ?>>
<head profile="<?php print $grddl_profile; ?>">
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <?php print $scripts; ?>
</head>
<?php // modify the layout by changing the id, see layout.css ?>
<body id="genesis-1c" <?php print $attributes;?>>
  <?php if (!$in_overlay): // Hide the skip-link in overlay ?>
    <div id="skip-link">
      <a href="#main-content"><?php print t('Skip to main content'); ?></a>
    </div>
  <?php endif; ?>
  <?php print $page_top; ?>
  <div id="container" class="<?php print $classes; ?>">
    <?php print $page; ?>
  </div>
  <?php print $page_bottom; ?>
</body>
</html>

龨齭鷰齡齠鷬鷪齵鷨鷦齡齠龫鷣鷡鷠鷞齿鹳鹰鷛黵龫鼩Html.tpl.php齉齅鷗龨鷓modules/system齉齅鷊鼩鷈鷅齀龳鷁

鶾齿齭鹈齐鶽齘龐鼥麡齉齅齵鸺鸸鶹齭齂龳鶵鶴鶰齭龫Drupal鸶鹔龫齻鸪齵齭麈鶮鶪鷬鷪鼾鹾龫龐黅鼩齲齯龨齭龫齡齠龙鶨鼖黓黒html.tpl.php齉齅龫鶤齵鷞鸶鹔麈麷黖鹪鹩龫龫Html.tpl.php齉齅齵鶠modules/system齉齅鷊龙龫鼥麡鼩鶾齿鼡鼝鷸龨麷黖龫齿Genesis龫鶚齡齠齵鶖Genesis齡齠齞黓黒麋鶔鶒龫html.tpl.php齉齅鼩鷈鷅齀鶎鷁

鸺鶋齵齲齯齭麷黖Genesis龫鶚齡齠龫鶤齵齭鶈鸣黵齘龐鼥麡齉齅鼩龃齿鼥麡齻鸪齭鸣黵龨鶚齡齠龫齉齅鷊龙鶇鶆鼯鼫鶄鶁鼩齭鸣黵鼌龫齿鼛sites/all/themes/genesis/templates齉齅鷊拷鵽鵹齭龫鶚齡齠齉齅鷊龙鼩龨鼡鼝龫鵷鶚龙齿拷鵽鵹psdtutorials齉齅鷊龙鼩

子主题文件夹

齭鵵鷶黖齭鵲鵱龫鵯鵬麹齅鸆鵨鼥麡黐鷓templates齉齅鷊龙龫html.tpl.php齉齅鼩齭鵵鷶鵦鵣鵢龫鵞鵚鵨HTML鵘鵕鼚黑黐黍鼩鸂鼡鼝黟黛鷿鷿龋龉龫鵔鵑鼩

龨鼡鼝鵐鵎鵍鵌PHP龗黖鷬鷪齵黟黙龳齂龳鵉龫鷳鵆鷠鷞鼩龨HTML鷳鷱龙齵PHP鵃鵀黷麇鴽鴺龫鴸鴵鴸鼐龅黛麋鼩<鴰?php鴫鼺php鵃鵀龫鵨齋齵?>鷞鴫鼺鴤鴠鼩鸧麳print鼛鴜鴚鸆鴖龅黛鼩Php龏鹭鷞黖鷪鴔鴑鴍黍$鴸鵣鼩齔鷓鶇龳鴅鴄鵲Drupal齡齠黛黙齵鼒鸄鷶龶鼥鴀php龫鷣鳿鼒鼐齵齞鳾鳼鳸鳴麋鼩

$language->language鴰鼚鴰$language->dir鴰齿齉齅龙龅鷸龫鳮龳鳪PHP龏鹭鼩$language->language鳩黓麋齉齅龫鷳鳥鼩鳢鷓鼥齿鳞鳜鼃鶁龫鳛鹶齵鸺鶋齵龨Drupal鳗鳖鳕鳓龫鷳鳥鸸鳞鷳齵鼾鷶龨龋龉鵘鵕龙鶔鳏鳌龅龫齿鳞齉龫鳋鶁麔de鼩$language->dir黓黒龫齿鷳鳥鹺鳇齵鼾鷶龨龋龉鵘鵕龙鸸ltr鶠鳃鳁黭鲾鷈left鴰to鴰right鷁鼩齲齯齭龨鳗鳖黓黒龫鲻鲺鷳鳥鸸鲹鲷鲶鷳齵鶋鲳鷞齐鸸rtl鶠鳃鲾黭鳁鷈right鴰to鴰left鷁鼩

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"
  
  <?php print $rdf_namespaces; ?>>

鲲鳗龨鷪鳖鼾鲱黇龫鷳鷱鸸齲鲾鲮鼾鼺麔

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" version="XHTML+RDFa 1.0" dir="ltr"

黱齂黛龫鵘鵕齿麔

<head profile="<?php print $grddl_profile; ?>">

麊龨鷪鲡鵢鼺鸸齲齂麔

<head profile="http://www.w3.org/1999/xhtml/vocab">

鼥鹯鳌龅龫齿鼔鷓GRDDL龫鲊鲈鼩

黱齂黛齿鲻龋龫鸧黖鵔鵑鲊鲈鼩

<?php print $head; ?>

麊鹂鸿麋鲻龋龫meta鷳鷱齵鼚鲇鲆龳鴀鲊鲈鼩

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
<meta about="/drupal/de/artikel/willkommen" property="sioc:num_replies" content="0" datatype="xsd:integer" />
  
<link rel="shortcut icon" href="http://localhost/drupal/misc/favicon.ico" type="image/vnd.microsoft.icon" />
  
<meta content="Willkommen" about="/drupal/de/artikel/willkommen" property="dc:title" />
  
<link rel="shortlink" href="/drupal/de/node/33" />
  
<meta name="Generator" content="Drupal 7 (http://drupal.org)" />
  
<link rel="canonical" href="/drupal/de/artikel/willkommen" />

黱齂黛齿鲻龋龫鴸齠鼩

<title><?php print $head_title; ?></title>

龨鷪鲡龋龉龙鵘鵕齲齂麔

<title>Willkommen | psd-tutorials.de</title>

鼥麡鴸齠齿黖黛鵢鼺龨鸵鸱鸮鴸鱽龶龫齵鹇齻鱻鱷黩黧鶈麈黖黭麊鼩

标题显示在浏览器标签上

鱳鶋鹇齻齵CSS鱭鹸鴫鶈齿鸧麳龳麡php黑黐黍鶁鱫黭鼯鼫齉齅龙龫鼩齲齂麔

<?php print $styles; ?>

鸭鸬龋龉龫齻鸪齵齡齠鱨鸓麈鹆鱫齖齐龫CSS齉齅鼩

<link type="text/css" rel="stylesheet" href="http://localhost/drupal/sites/default/files/css/css_p3syK-T8t8V3ZGjB8swO5jedvKfBvVtkoAjYdXNLClw.css" media="all" />
  
<link type="text/css" rel="stylesheet" href="http://localhost/drupal/sites/default/files/css/css_1F_DWBEe6Y_Lcyjyw2nPG4eT_LqzZlakOP7KI72f2lc.css" media="all" />
  
<link type="text/css" rel="stylesheet" href="http://localhost/drupal/sites/default/files/css/css_2tTaFkDpg4SwEzf7fKntXDus0W90gh3TRtU3OOCMM_w.css" media="all" />
  
<link type="text/css" rel="stylesheet" href="http://localhost/drupal/sites/default/files/css/css_nRO6Ys3khj3ugc-sJVpMesAwCuAesICrUvNM0FcBfos.css" media="all" />

鼚CSS齉齅麞麚龫齵Javascript齉齅鶈齿黖麞麚龫鹺鵆麇黅黁龫鶁鱫龋龉龫鼩鱳鷬齖齔齐龫齿齲齂龫php鷳鷱麔

<?php print $scripts; ?>

鼥鱢鷳鷱龨鷪鲡龋龉麈鲱黇麞麚齲齂龫鵘鵕麔

<script type="text/javascript" src="http://localhost/drupal/sites/default/files/js/js_3jHghlMLrjr9xXAC0JufqSSch3oAbkZstSqYdc4uuck.js"></script>>
  
<script type="text/javascript" src="http://localhost/drupal/sites/default/files/js/js_yBooQ7AJkK6sDqhu5cy003gG6ik9Ps-P4Ov8YpNnU5w.js"></script>
  
<script type="text/javascript" src="http://localhost/drupal/sites/default/files/js/js_2KlXA4Z5El1IQFVP5cy003gG6ik9Ps-P4Ov8YpNnU5w.js"></script>

龨html.tpl.php齉齅龙鱟鼖鵦鸼鲇鲆龫PHP龏鹭鼩鶾齿鼡鼝鱟齿鱞鱝齉鱚龫鱖鶵鱕鱓齵鱏鱋鱇齂鷿鼩黠黟齿body鼩

<body id="genesis-1c" <?php print $attributes;?>>

龨鼥鱢鷳鷱龙齭麈鷿黭龶龳龲龙鼡鼝龓齀黖Firebug齘龐麳龫ID鼩鷸龨齭鵵鷶鱅鴚鶔鶒龫鱂鰾黛齘龐鷰黖鼥麡ID鼩龶龳龲龙鼡鼝鳾鳼龯麳麋齭鼖鰼鴀鰸鰴鵵鷶麷黖鼩

print $attributes;

齭鵵鷶龨Genesis齡齠龫layout.css齉齅龙鰲黭齖齐龫ID鰰鼩齲齯龐黅鳗鷪鲡龋龉鶨鼖龏鰬齵鷞鰫鰪鰧齭龫鰣鷗鷈鳕鳓>齷麖>鰪鰧鰣鷗鷁鼩

清空缓存

龨鼥麡齉齅龙齭鱟麖鰲黭鲾鲮麾麼麔

Drupal齡齠鱨鸓鸧麳鼥鵃鷳鷱鼛鹈鹇龫鼯鼫齉齅鰡鷰龨龳鰝齵鷶鶋黛鸭鸬龅鲲鳗龫龋龉鼩鼥鲇龙鲲鷛黵龫齿龏鹭$page鼩鸺鸸龋龉龶鸚鰙鼾鼖龫麾麼黷齿鸧麳鼥麡龏鹭鸭鸬龅黛龫鼩鼔鷓鼥麡龏鹭齿齲鰗龗黖齲鰗鰖鶆龫鼛鰓龒黭page.tpl.php齉齅齵齖齐龫麾麼鼡鼝鼛龨齂龳龲龙龯龬鼩

鰐鰧鰍麔

鼥鹯龫$page_top鼚$page_bottom龨鳞鳜鼃鳛鹶龫齍齉龙麍鶨鼖鰋龒齵鲆鼝龈龅龫齿鵚鰉黐鷓龋龉鰆鵑鼚鰃鵑龫鰂麡鰀鯾龫region齵鯽鵞鯺鼩

<?php print $page_top; ?>
  
  <div id="container" class="<?php print $classes; ?>">
  
    <?php print $page; ?>
  
  </div>
  
  <?php print $page_bottom; ?>

齲齯齭齩黵黓黒龳麡鰀鯾鵞鯺齵鵵鷶龨齭龫info齉齅龙麷黖鲾鯷龫鵘鵕麔

regions_hidden[] = the_region_name

鶖鼥鹯page_top鼚page_bottom鵞鯺龫鰀鯾鯵齷齿鳢 hook_system_info_alter() 黓黒龫鼩鰀鯾鵞鯺鱂鯭鯬齭鯨鵆龨鵞鯦(block)龫鯢鷨鯞龉龙鰲黭麊鼩

鼥鱭鼌龫齍鸺齿鸸麋鯚鯗鼥鰂麡鰀鯾鵞鯺鹈麇齘龐齵麊鼝麆麃龫鹾黖齿鸸麋鸂齡齠鼀鯓鼯鯦麖鳴鶔齡鰸鰴龨龋龉龶鵑鼀鯓齂鵑龈龅龳鴀鯑鯐鼩鸺鶋齵齭鶈鹈齐鶽龐黅齭龫html.tpl.php齉齅龙$page_top鼚$page_bottom龫黐鳓鼀鯓鯎鯋麊鼝鼩鸺鸸鼥鱭麈鯊鯆鲇鲆鼯鯦龫麙麖鼩

鯂麡鵷鶚齵Toolbar鼯鯦齞齿鮿黖page_top鵞鯺黛龈龅鰆鵑龫鯢鷨鮻鮹鮸鱢齵鶨鮷齵齞齿麥鱢鮵鮵龫鯑鯐鼩鱟鼖龳鴀鼯鯦龨龋龉龈龅齻鸟鱫麋龳鴀鵘鵕齵麍鮱黵龨龋龉鰃鵑齔鼥鴀鴸鱽鶇鶆鼔鮭齵鼥齞鸣黵黖黭page_bottom鵞鯺鼩龨drupal7鷬鷪龫鮫鷡龙齵齿黖龫$closure龏鹭黛鶇鶆麞麚龫鮨鹾齵鶖drupal7龙鷞麷黖page_bottom鵞鯺黛鵘黊麋$closure龏鹭鼩鸧鹰齵鸸麋龋龉龫齷麖齵鼡鼝麈鮥龋龉龶龫JS鮢龨龋龉龫鰃鵑龈龅齵鼥齻麷黖龫鶈齿page_bottom鵞鯺齵鼔鷓JS龨龋龉龶龫鸟鹆鱕鱓齵鰫鮟鮜 鹗鮚鮘

function system_system_info_alter(&$info, $file, $type) {
  // Remove page-top and page-bottom from the blocks UI since they are reserved for
  // modules to populate from outside the blocks system.
  if ($type == 'theme') {
    $info['regions_hidden'][] = 'page_top';
    $info['regions_hidden'][] = 'page_bottom';
  }
}

本书共55小节:

评论 (写第一个评论)