I have a need to add a page to a Backdrop website that includes a view of some inputs submitted by other users and will automatically refresh in a browser every 20 seconds or so.

I have found a way of doing this by including some code in a custom version of the page.tpl.php file that I have added to my theme's templates. However, I suspect there must be a better way of achieving this. My code adds a refresh meta tag into the head of the page.

<?php $node = $GLOBALS['_GET']['q'];
if ($node == 'node/1079') {
  <meta http-equiv="refresh" content="20">
print backdrop_get_html_head(); ?>

I should be very interested to hear of alternative ways of achieving this.

Most helpful answers

Maybe check out the Block Refresh module to see how it does it...?


Yes, I'm hoping to do this though apparently there is something wrong with the current release.

I would prefer to refresh a block rather than the whole node so it would be good to have it.

indigoxela's picture

If your view doesn't use a pager, you could do it with some (javascript) code in your theme  that triggers RefreshView from time to time (RefreshView doesn't play nicely with pagers).

The meta tag is fine if it's OK that the whole page reloads.

Or maybe port D7 module views_refresh?

Thank you for the suggestions. Fortunately refreshing the whole page is proving adequate for my immediate need.

Are you offering to port one of these? Yes please!