【发布时间】:2014-11-20 11:36:56
【问题描述】:
【问题讨论】:
标签: html css drupal drupal-7 content-management-system
【问题讨论】:
标签: html css drupal drupal-7 content-management-system
我对此采取的常规方法是将 $title 从 page.tpl.php 移动到 node.tpl.php
这仅适用于节点。
/**
* Implements hook_preprocess_node().
*/
function hook_preprocess_node(&$variables) {
$variables['title'] = $variables['node']->type == 'content_type' ? drupal_get_title() : FALSE;
}
/**
* Implements hook_preprocess_page().
*/
function hook_preprocess_page(&$variables) {
$n = menu_get_object();
if ($n && $n->type == 'content_type') {
$variables['title'] = FALSE;
}
}
然后您可以在 node.tpl.php 中使用以下内容
<?php if ($title): ?>
<div class="title">
<?php print $title; ?>
</div>
<?php endif; ?>
我认为有一个 contrib 模块可以更改显示套件上的标题字段以允许您定位它等,但我通常只是添加这些,因为它比添加完整模块感觉更轻松。
【讨论】: