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小节:

评论 (写第一个评论)