【发布时间】:2018-01-25 19:42:18
【问题描述】:
我需要将变量从 views-view-unformatted.tpl.php 传递到 page.tpl.php。
所以views-view-unformatted.tpl.php的代码:
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>>
<?php print $row; ?>
<?php if(condition): ?>
<?php $my_var = array('val_1','val_2','val_3'); ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
结果我想要这样的东西:
...
<div class="footer">
foreach ($my_var as $val) {
print $val . <br>;
}
</div>
...
可以在page.tpl.php中打印views-view-unformatted.tpl.php中生成的变量吗?
谢谢!
【问题讨论】: