欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

page.tpl.php 内各种变量的例子

shiping1 的头像
<?php
 
/**
 * @file page.tpl.php
 *
 * 单个Drupal页面的主题化输出。
 *
 * 可用变量:
 *
 * 常用变量:
 * - $base_path: Drupal安装路径,相当于“/”。
 * - $css: 当前页面所用css文件数组。
 * - $directory: 此主题所在目录,例如: themes/garland 或 themes/garland/minelli。
 * - $is_front: 如果当前页面为首页则为真(TRUE)。用于切换是否显示任务说明。
 * - $logged_in: 如果当前用户为注册用户并已登录则为真(TRUE)。
 * - $is_admin: 如果当前用户有访问管理页面的权限则为真(TRUE)。
 *
 * 页面元数据:
 * - $language: (object) The language the site is being displayed in.
 *   $language->language 站点当前显示语言。
 *   $language->dir 站点当前显示语言方向。“ltr”或“rtl”其一。
 * - $head_title: 当前页面的页面标题。用于TITLE标签中。
 * - $head: HEAD区标记(包括meta标签,keword标签等。
 * - $styles: 此页面所须导入的所有css文件的style标签。
 * - $scripts: 此页面所须载入的所有JavaScript文件和设置的script标签。
 * - $body_classes: 用于BODY标签的一组css类名。包含用于标识当前页面布局(多列、单列),当前路径,用户是否登录等的标记。
 *
 * 站点特性:
 * - $front_page: 首页的URL。当链接到首页时,用于替代$base_path。它会包含语言域名或前缀。
 * - $logo: 主题配置中定义的logo图片的路径。
 * - $site_name: 站点名称。主题设置中如果未启用则为空。
 * - $site_slogan: 站点口号,主题设置中如果未启用则为空。
 * - $mission: 站点任务。主题设置中如果未启用则为空。
 *
 * 导航:
 * - $search_box: 用于显示搜索框的html输出,主题设置中如果未启用则为空。
 * - $primary_links (array): 包含此站点的主导航链接的数组,如果其已配置。
 * - $secondary_links (array): 包含此站点的次链接的数组,如果其已配置。
 *
 * 页面内容 (in order of occurrance in the default page.tpl.php):
 * - $left: 左边栏的HTML输出。
 *
 * - $breadcrumb: 当前页面的面包屑。
 * - $title: 此页面的标题,用于实际的HTML内容中。
 * - $help: 动态帮助文本,主要用于管理页面。
 * - $messages: 状态或错误信息的HTML输出。应该突出显示。
 * - $tabs: 标签式链接到当前页面下的任意子页面(例如:节点显示页面中的“查看”和“编辑”标签)。
 *
 * - $content: 当前Drupal页面的主要内容。
 *
 * - $right: 右边栏的HTML输出。
 *
 * 页脚/尾部 数据:
 * - $feed_icons: 当前页的feed图标。
 * - $footer_message: 在管理设置中定义的页脚信息(译注:/admin/settings/site-information)。
 * - $footer : 页脚区域.
 * - $closure: 任意模块可能提供的附加输出。此变量应始终在所有动态内容的最后输出。
 *
 * @see template_preprocess()
 * @see template_preprocess_page()
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
 
<head>
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <?php print $scripts; ?>
  <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyled Content in IE */ ?> </script>
</head>
<body class="root <?php print $body_classes; ?> no-scroller node-<?php print $node->nid;; ?>">
  <div id="wrap">
    <div id="header">
      <div id="logo-title">
 
        <?php if (!empty($logo)): ?>
          <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
            <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
          </a>
        <?php endif; ?>
 
          <?php if (!empty($site_name)): ?>
            <h2 id="site-name">
              <a href="<?php print $front_page ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
            </h2>
          <?php endif; ?>
 
          </div> <!-- /logo-title -->
 
      <?php if (!empty($search_box)): ?>
        <div id="search-box"><?php print $search_box; ?></div>
      <?php endif; ?>
 
      <?php if (!empty($header)): ?>
        <div id="header-region">
          <?php print $header; ?>
        </div>
      <?php endif; ?>
      
        <?php if (!empty($breadcrumb)): ?><div id="breadcrumb"><?php print $breadcrumb; ?></div><?php endif; ?>
 
    </div> <!-- /header -->
 
 
        <div id="sidebar">
              <div id="navigation" class="menu <?php if (!empty($primary_links)) { print "withprimary"; } if (!empty($secondary_links)) { print " withsecondary"; } ?> ">
        <?php if (!empty($primary_links)): ?>
          <div id="primary" class="clear-block">
            <?php print theme('links', $primary_links, array('class' => 'primary-links')); ?>
          </div>
        <?php endif; ?>
 
        <?php if (!empty($secondary_links)): ?>
          <div id="secondary" class="clear-block">
            <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')); ?>
          </div>
        <?php endif; ?>
      </div> <!-- /navigation -->
          <?php print $sidebar; ?>
        </div> <!-- /sidebar -->
 
 
      <div id="contentBox">
      
          <?php if (!empty($title)): ?>
            <h1 class="title" id="page-title"><?php print $title; ?></h1>
          <?php endif; ?> 
      
        <div id="contentInner">    
 
        
        <?php if (!empty($mission)): ?>
          <div id="mission"><?php print $mission; ?></div>
        <?php endif; ?>
 
          
        <div id="content">
          
          <?php if (!empty($tabs)): ?>
            <div class="tabs"><?php print $tabs; ?></div>
          <?php endif; ?>
          
          <?php if (!empty($messages)): print $messages; endif; ?>
          <?php if (!empty($help)): print $help; endif; ?>
          
          <div id="content-content" class="clear-block">
            <?php print $content; ?>
          </div> <!-- /content-content -->
          
          <?php print $feed_icons; ?>
        </div> <!-- /content -->
 
        
 
        </div>
      </div> <!-- /contentInner /contentBox -->
 
 
  </div>  
    
      <div id="footer">
        <?php print $footer_message; ?>
        <?php if (!empty($footer)): print $footer; endif; ?>
      </div> <!-- /footer -->
 
    <?php print $closure; ?>
 
</body>
</html>
 
普通分类: