当您想在 node.tpl 模板中创建一个区域时,您只需将
function xnalaraartbasic_preprocess_node(&$vars) {
$vars['your_region'] = theme('blocks', 'your_region');
}
在模板.php 中。但是如何在comment-wrapper.tpl 中放置一个区域?我找不到评论的钩子。
注释包装器预处理函数 (template_preprocess_comment_wrapper) 开始于 comment.module 的第 1825 行。在主题的 template.php 中尝试这样的操作:
function xnalaraartbasic_preprocess_comment_wrapper(&$vars) {
$vars['your_region'] = theme('blocks', 'your_region');
}
然后在您主题的comment-wrapper.tpl.php 中,尝试:
<div id="your_region">
<?php print $your_region; ?>
</div>
<div id="comments">
<?php print $content; ?>
</div>
并且不要忘记刷新您的主题注册表!