display_h" />
开发者

Drupal Views: How to a print the last time a View cache was refreshed to the view Display

I want to have on my page something like "This page last refreshed on: {DATETIME}"

I have tried to get the cache date but I have having trouble with the View display_handler object. $view->display_handler->get_plugin('cache'); is NULL, even though the View cache is currently set to 1 min. Any ideas how to print the DATETIME of the开发者_如何学运维 cache?

$view = views_get_view('Petition') or die ('no such view');
$view->set_display('Petition Signers Page');
$plugin = $view->display_handler->get_plugin('cache');
var_dump($view->display_handler);  //this is defined
var_dump($plugin); //this is NULL
$cache = cache_get($plugin->get_results_key(),$plugin->table));
$timestamp = $cache->created;


    <?php

$view = views_get_view('Consignment') or die ('no such view');
$view->set_display('page_1');
$view->execute('page_1');
$plugin = $view->display_handler->get_cache_plugin();
$cache = cache_get($plugin->get_output_key(), $plugin->table);
$timestamp = $cache->created;

print format_date($timestamp);

?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜