嗨,我正在尝试为 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.');
}
$disclaimer
并在中使用了这个变量comment-wrapper.tpl.php
:
<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() 中的免责声明(C:\wamp\www\drupal\sites\all\themes\ntheme\templates\comment-wrapper.tpl.php 的第 39 行)。
我在做什么错?