【发布时间】:2013-07-14 05:19:08
【问题描述】:
您好,我正在尝试为 drupal 7 主题创建一个新变量。我的主题名称是ntheme。为此,我在template.php 中定义了一个函数:
function ntheme_gnu_preprocess(&$variables)
{
$variables['disclaimer'] = t('Comments are unaythorized. The views expressed are those of the comment author.');
}
并在comment-wrapper.tpl.php中使用了这个变量$disclaimer:
<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if ($content['comments'] && $node->type != 'forum'): ?>
<?php print render($title_prefix); ?>
<h2 class="title"><?php print t('Comments'); ?></h2>
<?php print render($title_suffix); ?>
<?php endif; ?>
<?php print render($content['comments']); ?>
<?php if ($content['comment_form']): ?>
<h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
<?php print render($content['comment_form']); ?>
<?php endif; ?>
<p><?php print $disclaimer; ?></p>
</div>
但它显示通知:
注意:未定义的变量:include() 中的免责声明(第 39 行) C:\wamp\www\drupal\sites\all\themes\ntheme\templates\comment-wrapper.tpl.php)。
我做错了什么?
【问题讨论】:
标签: variables drupal drupal-7 drupal-themes