Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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.

share|improve this answer
    
I will need to add node.js on the server it may need some extra efforts or is it not so –  harshal Aug 22 at 6:21
    
@harshal yes you need to add node.js on the sever. Ofcourse you need to put effort to achieve this. :) –  Krishna Mohan Aug 22 at 6:27
    
any links on how to add node.js on server and integrate it with node.js drupal module? –  harshal Aug 22 at 6:31
1  
    
Also can we use views auto refresh for views block refresh using incremental refresh method? –  harshal Aug 22 at 8:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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