views:

26

answers:

3

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\" />;
A: 

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"

Jared
Thank you Jared - I can't figure out how to get the code to come through. But yes, the input format was set to PHP code.
RJL
When you're entering the code in the question, highlight it and then hit control-k
Jared
Based on the code above you're missing the closing quotes. Also you might be better off putting this tag into a template for the view instead of running it through the views ui. Click the theme infomation information link for your view and you'll get template code you can use.
Jared
A: 

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

Kevin
Thanks Kevin. The directions said both "should" be used, which is why I used both and also just the first tag.
RJL
+1  A: 

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

doublejosh

related questions