添加刷新标签到视图
我需要一个视图每 20 秒自动刷新一次,并通过视图 GUI 将以下代码添加到视图标题中 - 但没有成功。代码(或其部分)仅显示在视图上,并且不执行任何更新。我尝试省略两者并仅省略结尾的 ?php 语句。如果有人可以告诉我要使用的正确代码,或者自动更新视图的更好方法,我将非常感激。谢谢。
print "<meta http-equiv=\"refresh\" content = \"20\" />;
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 both 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\" />;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有一些模块可以通过 AJAX 为您处理此问题,而无需刷新页面。
这应该会为您处理一切:http://drupal.org/project/ajax_views_refresh
确保以主 AJAX 模块为基础。
如果您想编写一些代码,则可以使用更复杂的方法:http://drupal.org/project/live_update
如果您只想刷新节点并且视图位于它们上,您可以使用此进行旧式刷新... http://drupal.org/project/refresh
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
您的代码未通过,但如果它是 php 代码,请确保视图标头的输入格式设置为“PHP 代码”
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"
阅读文本区域下方的细则。有时 PHP 代码格式不需要
标签。一些模块以不同的方式实现这一点。
Read the fine print under the text area. Sometimes PHP Code format doesn't require
<?php
tags. Some modules implement this differently.使用 drupal_set_html_head
例如:
Use drupal_set_html_head
For example: