<tfoot id='GMO6H'></tfoot>

    <legend id='GMO6H'><style id='GMO6H'><dir id='GMO6H'><q id='GMO6H'></q></dir></style></legend>

          <bdo id='GMO6H'></bdo><ul id='GMO6H'></ul>

        <small id='GMO6H'></small><noframes id='GMO6H'>

      1. <i id='GMO6H'><tr id='GMO6H'><dt id='GMO6H'><q id='GMO6H'><span id='GMO6H'><b id='GMO6H'><form id='GMO6H'><ins id='GMO6H'></ins><ul id='GMO6H'></ul><sub id='GMO6H'></sub></form><legend id='GMO6H'></legend><bdo id='GMO6H'><pre id='GMO6H'><center id='GMO6H'></center></pre></bdo></b><th id='GMO6H'></th></span></q></dt></tr></i><div id='GMO6H'><tfoot id='GMO6H'></tfoot><dl id='GMO6H'><fieldset id='GMO6H'></fieldset></dl></div>

        drupal 使用 include 分隔模板代码页眉和页脚

        时间:2023-06-22

      2. <legend id='LK6Uf'><style id='LK6Uf'><dir id='LK6Uf'><q id='LK6Uf'></q></dir></style></legend>
          <tbody id='LK6Uf'></tbody>

          <small id='LK6Uf'></small><noframes id='LK6Uf'>

            • <bdo id='LK6Uf'></bdo><ul id='LK6Uf'></ul>

                  <tfoot id='LK6Uf'></tfoot>
                  <i id='LK6Uf'><tr id='LK6Uf'><dt id='LK6Uf'><q id='LK6Uf'><span id='LK6Uf'><b id='LK6Uf'><form id='LK6Uf'><ins id='LK6Uf'></ins><ul id='LK6Uf'></ul><sub id='LK6Uf'></sub></form><legend id='LK6Uf'></legend><bdo id='LK6Uf'><pre id='LK6Uf'><center id='LK6Uf'></center></pre></bdo></b><th id='LK6Uf'></th></span></q></dt></tr></i><div id='LK6Uf'><tfoot id='LK6Uf'></tfoot><dl id='LK6Uf'><fieldset id='LK6Uf'></fieldset></dl></div>

                1. 本文介绍了drupal 使用 include 分隔模板代码页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在创建一个 drupal 模板并尝试使用它

                  I'm creating a drupal template and tried using this

                      <?php require "".base_path() . path_to_theme()."'/header.php'" ?>
                  

                  它确实提供了正确的路径,但它提供了这个

                  and it does provide the right path, but it gave this

                  警告:require(/learn/learn_drupal/sites/all/themes/test_theme'/header.php'):无法打开流:require() 中没有这样的文件或目录(/Users/Devric/的第 33 行)Sites/learn/learn_drupal/sites/all/themes/test_theme/templates/html.tpl.php).

                  Warning: require(/learn/learn_drupal/sites/all/themes/test_theme'/header.php'): failed to open stream: No such file or directory in require() (line 33 of /Users/Devric/Sites/learn/learn_drupal/sites/all/themes/test_theme/templates/html.tpl.php).

                  有人知道如何分离代码吗?

                  anyone know how to separate the code?

                  推荐答案

                  如果我是你,我会阅读如何设置合适的 Drupal 主题.

                  If I were you I'd read up on how to set a proper Drupal theme.

                  首先在您的主题目录中构建一个模板文件夹.然后从根 modules/system/page.tpl.phpmodules/system/html.tpl.php 复制到这个新的模板文件夹.

                  Start by building a templates folder in your theme directory. Then copy over from the root modules/system/page.tpl.php and modules/system/html.tpl.php to this new templates folder.

                  这是您的主要主题文件.html.tpl.php 包含标题中的所有内容(元标记等)以及开始和结束正文标记.

                  This is your main theme files. html.tpl.php contains everything in your header (meta tags etc) and your start and end body tags.

                  page.tpl.php 是正文之间的内容,或者基本上是打印的内容 <?php print $page;?>.

                  page.tpl.php is what goes in between the body, or basically what is printed where it says <?php print $page; ?>.

                  如果您打开 page.tpl.php 文件,您将看到您的所有区域等.这是您的页面轮廓.使用它来整理使用硬代码或 Drupal 出色的块系统的任何页脚、页眉等.

                  If you open the page.tpl.php file you'll see all your regions etc. This is your page outline. Use this as to sort out any footers, headers etc using either hard code or Drupal's excellent block system.

                  如果您认为您的页面是这样应该会有所帮助:

                  If you think of your page like this is should help:

                  html.tpl.php -> opens your html page
                     - page.tpl.php -> any constant elements above the content
                        - node.tpl.php -> the content
                     - page.tpl.php -> any constant elements below the content
                  html.tpl.php -> closes your html page
                  

                  您不需要设置自己的包含,因为 Drupal 已经为您完成了所有这些工作.这是一个陡峭的学习曲线,我真的很难开始,但没有必要不以 Drupal 的方式做事,因为你正在失去使它成为如此优秀的 CMS 的原因.

                  You don't need to set up your own includes because Drupal already does all this for you. It's a steep learning curve and I really struggled to start off with but there's no point not doing things the Drupal way as you're losing what makes it such a good CMS.

                  您可以在此处阅读更多信息 - http://drupal.org/documentation/theme

                  You can read more here - http://drupal.org/documentation/theme

                  您可以将块设置为特定于页面,然后为它们设置主题.例如,设置一个名为 about header 的块,并设置为仅显示在块管理页面中您希望它出现的页面上.您可以按照与节点相同的方式为每个块设置模板.

                  You can set up blocks to be page specific and then theme them. Set up a block called about header for example and set to only be displayed on the pages you want it on in the blocks admin page. You can set templates up for each block in the same way you do nodes.

                  这篇关于drupal 使用 include 分隔模板代码页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:非常奇怪的 Drupal 7 404 行为 下一篇:首次访问页面时,Drupal 生成的 HTML 上方出现神秘数字

                  相关文章

                    1. <small id='Wvoh5'></small><noframes id='Wvoh5'>

                      <i id='Wvoh5'><tr id='Wvoh5'><dt id='Wvoh5'><q id='Wvoh5'><span id='Wvoh5'><b id='Wvoh5'><form id='Wvoh5'><ins id='Wvoh5'></ins><ul id='Wvoh5'></ul><sub id='Wvoh5'></sub></form><legend id='Wvoh5'></legend><bdo id='Wvoh5'><pre id='Wvoh5'><center id='Wvoh5'></center></pre></bdo></b><th id='Wvoh5'></th></span></q></dt></tr></i><div id='Wvoh5'><tfoot id='Wvoh5'></tfoot><dl id='Wvoh5'><fieldset id='Wvoh5'></fieldset></dl></div>

                    2. <tfoot id='Wvoh5'></tfoot>
                        <bdo id='Wvoh5'></bdo><ul id='Wvoh5'></ul>

                      <legend id='Wvoh5'><style id='Wvoh5'><dir id='Wvoh5'><q id='Wvoh5'></q></dir></style></legend>