基础篇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麬麫鼒龤鯻鴴龒龐黼

本书共56小节:

评论 (写第一个评论)