drupal 7 中的 $content 变量。(block.tpl.php)
$content variable in drupal 7.(block.tpl.php)
我的 drupal 7 中有一个 ablock 模板。
文件block.tpl.php是这样的:
<?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
<h3<?php print $title_attributes; ?>><?php print $block->subject ?></h3>
<?php endif;?>
<?php print render($title_suffix); ?>
<li class="leftMenu_goPortal_options" style="display: list-item;">
<ul class="gn-submenu">
print $content_attributes; ?>
<?php print $content ?>
</ul>
</li>
我想更改 $content 变量,因为我在网站上的内容区域都是 ul 或 li。
我需要 2 个变量,一个用于块内容,一个用于站点内容。
TNX!
block.tpl.php 中的 $content 将只有块的内容。如果您想查看当前所在页面的 html,可以使用 page.tpl.php,其中打印了其中的区域和块。
function THEME_preprocess_block(&$variables) {
.
.
.
//change $variables['content'] as needed
.
.
}
我的 drupal 7 中有一个 ablock 模板。
文件block.tpl.php是这样的:
<?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
<h3<?php print $title_attributes; ?>><?php print $block->subject ?></h3>
<?php endif;?>
<?php print render($title_suffix); ?>
<li class="leftMenu_goPortal_options" style="display: list-item;">
<ul class="gn-submenu">
print $content_attributes; ?>
<?php print $content ?>
</ul>
</li>
我想更改 $content 变量,因为我在网站上的内容区域都是 ul 或 li。
我需要 2 个变量,一个用于块内容,一个用于站点内容。
TNX!
block.tpl.php 中的 $content 将只有块的内容。如果您想查看当前所在页面的 html,可以使用 page.tpl.php,其中打印了其中的区域和块。
function THEME_preprocess_block(&$variables) {
.
.
.
//change $variables['content'] as needed
.
.
}