Closed (fixed)
Project:
Views Hacks
Version:
6.x-1.x-dev
Component:
Views Filters Auto-refresh
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2011 at 10:29 UTC
Updated:
27 Nov 2011 at 22:00 UTC
Performing a full bootstrap + rendering a view is very expensive and can negatively affect the performance of the site, if done at each refresh.
Instead, it is suggested to let the module accept an additional, arbitrary URL that can be hit at each refresh interval to determine whether there's something to refresh or not. Because this is a hand-made script, it will be much more efficient than a full-scale view rendering.
Comments
Comment #1
infojunkieImplemented in latest dev. Here's how it works:
The additional theme parameter
ping_base_pathis used to inform Views Auto-Refresh that this URL should be hit before the secondary view. The script at this ping URL should accept a GET parameter calledtimestampand return a JSON response of the following form:where
$countis 0 if there are no new items sincetimestamp, > 0 otherwise.For example, here's a complete ping script:
This script illustrates parsing the Drupal MySQL connection string, getting a number of parameters including
timestamp, and returning the expected JSON response.Comment #2
infojunkieThe Views Auto-Refresh theme function should be called with an additional setting
ping_base_pathas such:Comment #3
l00ph0le commentedAny idea if this will work in D7? Looks great btw, exactly what I am looking for.
Comment #4
infojunkieI'm currently focusing on D6, no plans to move to D7 unless someone else wants to undertake the port.
Comment #5.0
(not verified) commentedReworded.