简体   繁体   English

drupal 7中的$ content变量。(block.tpl.php)

[英]$content variable in drupal 7.(block.tpl.php)

I have a template for ablock in my drupal 7. 我的drupal 7中有一个用于阻止的模板。

The file block.tpl.php is like this: 文件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> 

I want to change the $content variable, because my content area in on the site all is like ul or li. 我想更改$ content变量,因为该站点上的内容区域都像ul或li。

I need to have 2 variables, one for block content and one for site content. 我需要有2个变量,一个用于阻止内容,一个用于站点内容。

TNX! TNX!

The $content inside block.tpl.php will have only the content of the block. block.tpl.php中的$ content将仅包含块的内容。 If you want to see the html of the page you are currently in, you have the page.tpl.php, where regions and blocks inside those are printed. 如果要查看当前页面的html,则可以使用page.tpl.php,在其中打印区域和块。

Use hook_preprocess_HOOK 使用hook_preprocess_HOOK

function THEME_preprocess_block(&$variables) {
.
.
.
//change $variables['content'] as needed
.
.
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM