1

I want to refresh a views block whenever new content is added. I am using views auto refresh module

Quick HOWTO: Using a ping script

Using a ping script is essential for production environments, to avoid a full Drupal bootstrap at each refresh.

Create a new page view Copy the file ping.php.example to your Drupal root folder and rename it as ping.php Edit ping.php such that DRUPAL_ROOT points to your Drupal root, and adjust the query: $result = $db->query("SELECT count(nid) FROM node WHERE created > $timestamp");

to reflect your view's generated SQL query. Make sure to keep the created condition in the query. Add a new header of type Global: Autorefresh with: Set the interval time to 5000ms Check Use a ping url In Path to the ping script, enter ping.php Save the view and open its page In a second browser tab, add a new content that fits the view's criteria See the new content in the view!

Is there any other way we can refresh a views when content is created

1 Answer 1

3

You can achieve that using the Views node.js module

This module implements dynamical update of views by nodejs after executing rules action. This module implements rules action which we can add to any rule for updating some views (views which need update, one can select in action).

During updating of views all arguments that are already passed to view will be taken into account.

It is also correctly working with views which use ajax. Introducing video.

8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.