基础篇17. 添加一篇内容,drupal网站的页面结构

龷龶龵龳龲龮龫龨龥龣龠龞龚龖龕龣Drupal龅龄龃龀齿齾齽齻齷龫齴齰齯齫齨齤齡龕齟齜齘齗齓齐龫齍齊齈齄龕齁鼿鼽鼹龫龥鼸鼷鼴龕鼳鼯齐齾鼭鼫齜鼨鼧鼤鼽鼹鼣龕鼟鼝龕鼙鼕齐鼒鼎齍齊龚龖龕鼊鼊鼆鼄鼀黾黽鼤黻黷黶鼊黵黴鼀 龵黱

黮黬黩龮黦黢齡龥龚龖龕點黝龮黙黗齡龲drupal黒黑龫黏黌鼀

黉黶龕齨黅黦黢龚龖黃龳鼀麿麼Article龕黻黷龫article麯basic page龣麣麡麟麝麚黝龫龨齰麖麓龚龖麏麍鼀

黬黩黶麉麆麂鹿齡龥Article龕鹾鹺龣齍鹶鼀鹴鹱鹭龃鹪龄鹦鹣齷鹦鹡齍麯鹪鹠鼀齨黅鹝鹙龕黬黩鹗麚鹕鹔龕黻鹺龣黬黩鼤黻齰麣麡鹓麂鹿龫鹒齡龥齍鹶鼀

黬黩鹗麚鹕鹔龕黻齰齁Drupal鹏鹍龫黒黑龕龣齁鼳鼯鹌鹊龫鹉鹴黌鹍龫鼀黮黬黩齡鹆齡鹆龕齁鹄鹃龚龮鹀鸾鼀

黉黶龕鸽鸻齡齰黒黑鸹龣HTML黌鹍龫龕鸫鸨齜龫HTML黒黑鸹鸤鸠鸟龕HTML鹦head鹦body鸕鹪鹠鼀鼤Drupal龫龅龄鹆龕黻鸔齁齡齰鸑鸐html.html.twig龫鸉鸅齍鸁龮鷿鷻鼀鷷龣鸨齜drupal黒黑齽鹄鹆龫鸉鸅鼀

龳龲龮龕鼤html龫body鹪鹠鼣龕鸠鸟鷳黒黑鹓龫鷯鹉鹴龫鷬鷫龕黻鸔鷬鷫鸹鸤鷨鷦鷣鼤page.html.twig鸉鸅鼣鼀鼟鷡黬黩龣鷠鷡鷜鷘鷖鷓鷐鹔黻齰麣麡鹓龫龕鸨麚龕鷎鸤鼤黒黑鷍鹉齜齡齰鷊鷇龫鷜鷘鷃鶿鼀黻齰鷃鶿龣鶼鶻鼿黒黑龫龕鸨麚鶸鼭鹌鸠鸟鼤page.html.twig鼣鼀鸫龣鷦鼤toolbar.html.twig鼣鼀鼤鹆鶴鶲鶯鹓龕龨鶬龣鹊鶴龫鼀鶫鶩龣鶨鶦鶥鶣鶠鶟黻齰麣黒龕鹺鹌鸤鶝鶜黻齰鷃鶿龫鼀

黒黑page鼣龕鶘鸠鸟鹌鹊龫鶕鶒龕鹾鹺龣region鼀鶕鶒鷊鶎鷇龫鸉鸅齍鸁龣region.html.twig鼀點黝鼤鹊齡齰鶕鶒鼣龕鶘鸤鸠鸟鹌鹊龫鶕鶋龕block鼀鶕鶋鷊鶎鷇龫鸉鸅齍鸁龣block.html.twig鼀

鶇鹗麚鹕鹔龕黒黑鹓鶄鶁鵽鵹鹪鶜龫龣鶕鶒龕鵵鶁鵽鵹龣鶕鶒鼣龫鶕鶋鼀鶇鹗麚鵱鶕鶒鵮鵬鹍鵪鵨鼣龫鶕鶒龕齘鶫鵤鶩鶕龕鵢鵟鶕龕鼤鵤鶩鶕鼣龕鸤齜鹌鹊龫鶕鶋龕齘鶫龕鵜鵛龕鵘鵖龕鵕鶩鼀

鼤龅龚龖鶕鶋鼣龕鷎齜齡齰node.html.twig,鷷鶥龮鵐鼨鵍齡齰drupal龫齾齨龕鹾鹺龣鶇鵊鵆黦黢龫黻龥齍鹶鼀黻齰齍鹶鵃鼿article龚龖麏麍龕鸫鵍齡齰龚龖麏麍鶘鸹龣齁鹌鹊龫鵀鴽黌鹍龫龕鼟鼝龕node鼣鷎鸤鸠鸟鹌鹊龫鵀鴽鸉鸅龕鼤黦黢齍鵀龫鴹鴸龕黬黩鹭鴶黴鹡齍鵀鴽麯鹪鹠鵀鴽龕麚鴵黬黩鼫齜鹭鴶龫鴲鴰鵀鴽鼀

鶇鹗麚鼤鷬鷫鴬鴨鶕鶒鴤鶥twig debug鸉鴢鹴鹱鴡鹔鹓鴝鸉鸅鼀

twig debug鸉鴢鸤鹴鹱鴛齄鵍齡齰鸉鸅龫鶟鴚麯黏鴘鼀鼭鴗鸤龶鴕鶇鷨鴔鶥龫鸉鸅鼤鴓鴏齍鸁鴋鼣鸨鴇龫鴅鷣鼀黻黷黬鹺鹌齡齡鴃鶜黴鼀

黬黩鸤鼤黝鴁龫鳿鳾鼣鳽鹔龵鶕鶒鼤info齍鸁鼣鳹鳷龕鼤鸉鸅齍鸁鼣鵐鼨龕鼤鶕鶋鳵鳴黒黑鷜鷘鼭鷦鷣鶕鶋鹔鶕鶒鼣鼀

鳱鳮鶕鶒麯麖麓鶕鶒

Drupal鸤鷡黬黩鳪鳦2齰鳱鳮鶕鶒龕鷷黩鹴鹱龣page top麯page bottom鶕鶒龕齤鸨麚鸑鷷黩鳱鳮鶕鶒龣鼟鷡鶇鳢鳠鼤鶕鶋鳵鳴黒黑鹕鹔鶸黩龕鹾鹌鳜齷鶇鼤info齍鸁鼣鳹鳷鶸黩鼀

鼤html.thml.twig鼣鵐鼨龕麚龲龣stable龅龄龫html.html.twig齍鸁鳘鳖龵

<!DOCTYPE html>
<html{{ html_attributes }}>
  <head>
    <head-placeholder token="{{ placeholder_token|raw }}">
    <title>{{ head_title|safe_join(' | ') }}</title>
    <css-placeholder token="{{ placeholder_token|raw }}">
    <js-placeholder token="{{ placeholder_token|raw }}">
  </head>
  <body{{ attributes }}>
    {#
      Keyboard navigation/accessibility link to main content section in
      page.html.twig.
    #}
    <a href="#main-content" class="visually-hidden focusable">
      {{ 'Skip to main content'|t }}
    </a>
    {{ page_top }}
    {{ page }}
    {{ page_bottom }}
    <js-bottom-placeholder token="{{ placeholder_token|raw }}">
  </body>
</html>

鲕鼣鲒鲎鹒6麯鹒4鲇龫鳘鳖鹺龣鶥鼿鵐鼨黻龨齰鳱鳮鶕鶒鼀鲃黑鳪鹔龫鷜鷘鱿鱼鱹龕鱶toolbar.html.twig鹺龣鱵鲒鲎鹒鱳鲇龫page top鶕鶒鼣鵐鼨龫鼀

鶫鶩龕黬黩鹌鼤info齍鸁鼣鳹鳷鸽鸻鶕鶒龕鱰鱬Drupal鸤鷡黬黩鳪鳦10齰麖麓鶕鶒鼀

鶸黩鹴鹱龣龵

  1. page.header
  2. page.primary_menu
  3. page.secondary_menu
  4. page.highlighted
  5. page.help (dynamic help text, mostly for admin pages)
  6. page.content (main content of current page)
  7. page.sidebar_first
  8. page.sidebar_second
  9. page.footer
  10. page.breadcrumb

鶇鷎鹗麚鼤page鸉鸅龫鱡鱟鼣鴡鹔鶎鼿鷷黩龫齈齄鼀

鶫鶩鼤info齍鸁鼣鳹鳷黴鱛鱚龫鶕鶒龕鱰鱬麖麓龫鶕鶒鹺鹌鱗鱔鷠鶥黴龕黻鹊鱒鹾鷨鼽鷠鱑鴶鼀鹊鷘龕鶫鶩鶇龫黒黑鳵鳴鹡鱎鱊鱉黻10齰麖麓龫鶕鶒龕鱰鱬鶇鹺鹌鳜齷鼤鶇龫info齍鸁鼣鶎鶕鶒鱆鲇鳹鳷鼀

鱗鱄鱃齡鱀龵齡鰽鶇鼤鱛鱚龫.info齍鸁鼣鳹鳷黴齡齰鶕鶒龕鹺鸤鱑鴶鰹鰷鹉龫麖麓鶕鶒鼀

鶫鶩鶇鳹鳷黴鱛鱚龫鶕鶒龕鶇鷎鳜齷鶥鶎鷇龫鳘鳖鰴鶸鵐鼨鹔黒黑鹓龕黻齰龚龖鰴鼤龲齡齾黙鴝鼀鴏鲃龕鶇鰰鳜齷齯鰬龕page top麯page bottom鶕鶒龣鼤html.html.twig鼣鵐鼨龫龕鸫鲕鷷鸨齜龫鶕鶒鸹龣鼤page.html.twig鼣鵐鼨龫鼀

本书共76小节:

评论 (2)

  • 29
    • 2018-09-10

    并没有 html.tpl.php 和 page.tpl.php 这两个文件。跟版本有关吗?我用的是 8.5.6

    • 2018-09-11

    .tpl.php文件是Drupal7的,这里是html.html.twig和page.html.twig,感谢指出错误