基础篇21. 模板中的变量,devel kint,html模板

龺龶龵龱龮龪龨龧龦龢龠龜龛龙龕龢Drupal齼齺齷齶齲齱齯齬齪龨齦齢齠齜齘齕齔龕齐齍齌齊齉齅龨齁齀鼾鼽龕鼻鼹鼶鼵龨龦鼴鼱鼭龕鼫鼨齅齱鼦鼣齍鼡鼝鼙鼶鼵鼖龕鼔鼑龕鼐鼎齅鼋鼈齁齀龛龙龕鼆鼆鼄鼃鼁黿黽鼙黹黷黳鼆黰黮鼁 龵黪

鼙齕黩龨黥齱鼖龕黢黟黛黚黮黗黖黕黒黏黋黈黇龕黢黟黄黰黗黖龨黂麿龪麼麸html麭麬龕黄黰黇龪麨齷CSS黏JS鼁麠麟麝龢鼻HTML龪黋黈麑麍龕CSS黋黈麉麿龕JS黋黈麇麄麃麂鹾鼾鹻鹺黪龕鹶麄黩鹴鹰鹮鹭龕黢黟鹩鹨鹧黹鹤鹡鹞鹝鹙鹗鹖黮龕鹔黹鹤鹡鹞鹐鹍鹋鼙鹈龨鹄龕鹃麟麝鹀鸾鸽鸼龮龛龙黮鼁鸹龢龛龙龢鸵鸱龪龨鸯鸬黹齔齱龕黢黟鸫鸪鸨黹齢鸥齺鼁

黕黒鼖龨麸鸡

鼙鹀齔齱鼖黢黟黗黖黮page黕黒龕鼦鼙鸛鼖鸘鸗黮齔麇鸓鸏龕鸌鸾龢齔鹧h1麭麬鼁鼙黹鹧h1麭麬鼖龢黢黟鸈鸆鸃齷龨齁鷿龛龙鷽hello drupal鷸鼁黹齢齁鷿鸾龢黢黟鸘鸗鷷麟麝鹀龨龛龙鼁

黢黟鼙黗黖黕黒龨鷴鷰龕鼦鷮鷪鹙黹鸱鷧龕鼔麄黹鷥鷽黖鷤鷸鼙黕黒鼖龨龛龙龕龢鷠鷜鷙鷖drupal鷔鷑龪鷎鷌黏鷈麼龨龕鷅鷃齪鷈麼龕鷁鶿鶾鶼鶸黹齢黕黒齁鶶鼁麠drupal鹶麄齔齢CMS麃content management system黪鸌鸾龢龛龙鷎鷌鷔鷑龕鶨龨鹶鷖鸾鼙鼹鸫鶥鷥龛龙鶣鶟鼙鶝鶚黇鼖龕鶙鶘鸫鶗黟鶕麸鸡龨鶓麿鸃鼡鷷麟麝鹀鼁

鶏鶕龕鶌黢黟鹔黹齢鷽hello drupal鷸龨齁鷿麼麄齔齢麸鸡龕鼙黕黒齁鶶龨鶉鶆鼖龕黢黟鶂鶕鶁鷷齦齢鼙page黕黒鼖鹙鷖龨麸鸡龕拷鵽鸛鼖齔齢龕齌鷅 logged in 鵷鵶鷽hello drupal鷸 鼁 龧鹧鵵鵱鵭龢twig鷖龪鸃鼡鵨鵦麿麑鷃龨龕鵤鼹twig龕黢黟鶕鶘鵢鵟鵜齶黛鼁

黹龢齔齢鵘鵗鵖鵔龨麸鸡龕鷖鼹鵒鵏鷖鵌龢鵋鶉鵇鼦鵃鵂鼁黢黟鼝鼙龢鵃鵂鵁鴿龕鼔鼑龕鼙麟麝鴾鴽鸃鼡龨龢1鼁

鶉鶆鼖鴻鼡龨鴷鴷龢page黕黒鼖齯鹙鷖龨麸鸡龕鹋鼑齕鹈龕鵢齍齔鹤鸛鶗龨麸鸡鶂鶕鷙鷖鼁黹鹤麸鸡齍龨龢鼻Drupal鴶鴲鴱鴯龨龕齍龨龢鼔麄鴮鴬鴨黮鸛鶨黕鴦龕鼻黹鹤黕鴦鴱鴯龨鼁

devel kint

鶙鶘龕黢黟鼙黕黒齁鶶龨鶉鶆龮黂龕鸓鸏龨鴾鴽龕鸘鸗齔齢鴞鴜龕鴮鶂鶕鼙齁齀鼖鴙鷷黹麇鴘鴕鼁

{{ kint() }}

黹齢鴞鴜龢鼻黢黟鼙鴉14齱鶏鴬鴨龨devel kint黕鴦鴱鴯龨鼁鶨鶂鶕麄黢黟鼙麟麝鹀鴁鳽黕黒鼖鶏齍龨麸鸡鼁鼙鷙鷖鶨齕黩龕鴮鵢鳼齪鳻鳺twig debug鳴鳱鼁鵤鼹黹齢龕黢黟鼙鴉11齱鼖鳭鳫黰鼁

kint鼙麟麝鹀鳧鳣黮齔齢鳟鳝龕齘鳜鳚鳻鶕鶘龕鴮鶂鶕鶁鷷鶏齍龨麸鸡鶕鳘鶨黟龨鳗鵤鳖鳓鼁

黹黷龨page龢齔齢鶝鳒龕鳚鳻齕鶘鴮鶂鶕鶁鷷黹齢鶝鳒鼖龨鳑鳎龕鸛鼖齍齔齢title鼁

鼙黹黷龕黢黟鹔齕黩龨logged in 鵷鵶麄 page title 龕鶨龨黖鷜鳍php鼖鶝鳒龨黖鷜龢齔鳉龨龕鴮鶂鶕鳇鶁齁齀鼖龨鸓鸏鼁

<h1 class=“v1”> {{ page['#title'] }} </h1>

鶣鶟鶘鲮鲪鲨鲧麟麝龕鶂鶕鶁鷷龕鲦麟鼔麄鼣齍麭齺龕鼔鼑龕麟麝鴾鴽鼦鼣齍鸃鼡黹齢麸鸡鼁鳚鳻kint鳧鳣龨鳟鳝龕鴙鷷page鼖龨title龕黢黟鶂鶕鶁鷷黹黷龢齔齢黽鷿鲥鲤鼁

黢黟鲢鵶鷷齁黥麟麝龕麟麝鴾鴽齬鲞鴁鳽黮龧鲪麟麝麭齺龕鸛鼖龨鴉齔齢龕鲜龢黢黟鸘鸗龨黹麇鸓鸏龨麑鷃鼁鳚鳻kint鳧鳣龨鳟鳝龕鴙鷷page鼖龨title龕黢黟鶂鶕鶁鷷黹黷鲛鳫黮鳗鹩龨鳖鳓鼁

鼔鼑龕鲙鲖twig debug黕麿黏devel kint龕黢黟鶂鶕鷙鷖kint鴘鴕龪鴁鳽黕黒鼖鶏齍龨鶂鷖麸鸡龕鶕鼑龪鴙鷷黢黟鶏鳼齪龨麸鸡龕鼦鸫鶨黟鼙黕黒鼖鴁鳽鼡龪鼁

鼙鲔齱鼶鼵鼖龕黢黟鴷鴷鳚鳫黮鼙page黕黒鼖鷙鷖kint龪鴁鳽麸鸡龕鴮鵢鶂鶕鼙鸛鶗龨黕黒鼖龕鷙鷖鵖鲓龨黂鷜龪鳇鶁鶗黟鶥鸈鶂鷖龨麸鸡鼁

齯鶘龕鴮齪鶉鲒龨龢龕黹齢kint鳧鳣龨鳟鳝鲎鲋龨鸗鵭龕齔鲇鲆鲂龮龕鷮齪齘鳜鼁鼔麄龕黹齢鲀鱼鵟鳚鳻黹齢鳟鳝龨鱺齔鱹鼁黹麉龕鱵鱵鵟鱱鳉麟麝鱰鷤鼁

html.html.twig黕黒

齕黩黢黟鴁鳻黮page黕黒龕鼦鹧鶗鷧黮鷈麼鼁

黹黷黢黟鲮龪鶁齔龮html黕黒鼁黹齢黕黒龨鸓鸏鼫鱩龵

{#
/**
 * @file
 * Theme override for the basic structure of a single Drupal page.
 *
 * Variables:
 * - logged_in: A flag indicating if user is logged in.
 * - root_path: The root path of the current page (e.g., node, admin, user).
 * - node_type: The content type for the current node, if the page is a node.
 * - head_title: List of text elements that make up the head_title variable.
 *   May contain one or more of the following:
 *   - title: The title of the page.
 *   - name: The name of the site.
 *   - slogan: The slogan of the site.
 * - page_top: Initial rendered markup. This should be printed before 'page'.
 * - page: The rendered page markup.
 * - page_bottom: Closing rendered markup. This variable should be printed after
 *   'page'.
 * - db_offline: A flag indicating if the database is offline.
 * - placeholder_token: The token for generating head, css, js and js-bottom
 *   placeholders.
 *
 * @see template_preprocess_html()
 */
#}
<!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>

鼙黹齢黕黒鼖鸃鼡黮DOCTYPE鰱html鰱head鰱body麭麬龕黹鹤龢html麟麝鶏鷮鶂鰮鰫龨鹡鹞鼁鶙鶘鵢齍齔鹤麸鸡龕齌鷅鷖鼹鸃鼡麭齺鰱css黏js龨麸鸡龕鷖鼹鸃鼡麟麝黕黒龨麸鸡page鼁黹黷龨js龕鵟鰨鶚黇鼖龨鰧鼽龪鵒鵏鹩鹨鸫齁鶶鰥鼙麟麝龨鴾鴽head麭麬鼖龕鵢龢鰥鼙麟麝龨鰢鴽鼁

{{ page }}

黹鰟鴞鴜鷖鼹鸃鼡鰝鰚鼙html黕黒鼖龨page黕黒鼁

{{ page_top }}
{{ page_bottom }}

鷖鼹鸃鼡麟麝鹀黂黏龮黂鰙鸗龨鳟鳝龕齌鷅黢黟齕黩鴱鷷黰龨鷎鷌鰘鵃鰗齕鶘龕鼙麟麝鴾鴽鲛鳫龨鷎鷌鰓鰐鸾龢鰏黹黷龨page top鸃鼡龨鼁

麠page黕黒麃page.html.twig黪龕鷁鷖龪鸃鼡body麭麬鼖龨鰍鴽龛龙鼁

本书共76小节:

评论 (写第一个评论)