【发布时间】:2011-02-03 22:39:11
【问题描述】:
Drupal 6 的缓存可以设置为禁用、正常或激进。我无法为我的 Drupal 7 安装找到这些选项。只有一个按钮可以刷新所有缓存,但我对模块或模板所做的每一次更改都必须单击它。通过更改,我的意思是向模块或模板添加一些 HTML 标记。
感谢 mirzu 的回复,我已经安装了devel module,但它也不起作用。我看到我的更改的唯一方法是禁用和启用该模块。
hello.module 看起来像:
function annotate_menu() {
$items = array();
$items['hello'] = array(
'title' => t('Hello world'),
'page callback' => 'hello_output',
'access arguments' => array('access content'),
);
return $items;
}
function hello_output() {
header('Content-type: text/plain; charset=UTF-8');
header('Content-Disposition: inline');
return 'annotate';
}
模板页面-hello.tpl.php 包含print $content;。
我通过http://localhost/test/hello访问该页面。
【问题讨论】:
-
定义“更改”,您要准确更新什么?有些东西被缓存了,但一般来说,你应该能够改变一个函数的内部,例如它应该更新。您是否以匿名用户身份进行测试,并且可能启用了页面缓存?如果您发布一些代码也可能会有所帮助..
-
我添加了我的模块和模板的代码。
-
可以禁用大部分 Drupal 的缓存,请参阅drupal.stackexchange.com/questions/28340/…上的答案