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

评论 (写第一个评论)