【发布时间】:2016-10-03 20:47:50
【问题描述】:
我是主题的新手,我只是继承了这段代码。我需要控制打印#output 的位置和方式,但它总是显示在页面顶部的HTML 标记上方。我查看了可渲染数组 API,但找不到任何特定于我的问题的内容。
在 mytheme.module 中:
function mytheme_output_block() {
$content = array(
'#theme' => 'my_theme',
'#output' => function_that_returns_JSON();
...
function mytheme_hook_theme() {
return array(
'my_theme' => array(
'vars' => array(
'output' => '',
...
我在 my_theme.tpl.php 中尝试过:
<?php print $output; ?>
但它被忽略了。如何控制 #output 以便我可以设置样式?
【问题讨论】:
-
您能否发布更完整的代码集,尤其是来自 my_theme.tpl.php 的代码集?
-
不是真的 :( 但其余的都不重要,因为我现在只关心打印 $output。