【发布时间】:2015-10-08 10:29:57
【问题描述】:
这是 vegas.module 文件的代码。它用于从特定文件夹加载图像。
function vegas_init() {
// Load all the images to be added to Vegas.
$backgrounds = array();
$fade = variable_get('vegas_fade', 0);
for ($i = 0; $i < 10; $i++) {
$fid = variable_get('vegas_images_' . $i, '');
if (!empty($fid)) {
$image = file_load($fid);
if ($image) {
$background = array(
'src' => file_create_url($image->uri),
);
if (!empty($fade)) {
$background['fade'] = intval($fade);
}
$backgrounds[] = $background;
}
}
}
我在 .module 文件中打印它。它给出了预期的结果。
print_r($backgrounds);
如果我在主题的 page.tpl.php 中打印它,它不会返回任何值。有没有办法加载模块的变量
【问题讨论】:
标签: php drupal-7 drupal-modules drupal-theming