开发者

Adding Refresh Tag to View

I need a view to refresh automatically every 20 seconds, and have added the following code to the view header via the views GUI - with no success. The code (or portions of it) are simply displayed on the view and no updating is performed. I've tried omitting bo开发者_运维百科th and just the ending ?php statement. If someone can tell me the proper code to use, or a better approach at updating the view automatically, I'd be very appreciative. Thanks.

print "<meta http-equiv=\"refresh\" content = \"20\" />;


There are a few modules that can take care of this for you via AJAX without refreshing the page.

This should take care of everything for you: http://drupal.org/project/ajax_views_refresh Be sure to get the main AJAX module as the base.

A more complex one, if you want to code a bit: http://drupal.org/project/live_update

If you want to just refresh nodes and the view is on them you can do the old school refresh with this... http://drupal.org/project/refresh


Your code isn't coming through, but if it's php code make sure that the input format for the view header is set to "PHP Code"


Read the fine print under the text area. Sometimes PHP Code format doesn't require <?php tags. Some modules implement this differently.


Use drupal_set_html_head

For example:

drupal_set_html_head('<meta http-equiv="refresh" content = "20" />');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜