Forums / Developer / ViewCaching and $view_parameters
Michael Enger
Friday 24 June 2011 2:03:15 am
I've created a custom layout for handling AJAX requests which fetches content based on passed view parameters, but when ViewCaching is enabled the $view_parameters array only contains content the first time the layout is shown.
I call the address example.com/layout/set/ajax/(node_id)/155 and use the attribute operator to print out the contents of the $view_parameters array to test it, and it's clearly empty after the first time. I tried using a cache-block with the $view_parameters area as keys, but that doesn't help since the array becomes empty and using a static value for keys would mean that it will show the same content no matter what view parameters are sent to it.
I also tried to set the cache_ttl variable to 0, but to no avail.
Friday 24 June 2011 3:45:27 am
Discovered what was wrong, thanks to a coworker of mine:
Apparently, the layout module gives you access to the GET parameters, but not the view parameters, which is the exact opposite of what the content module does. Great.
Gaetano Giunta
Saturday 25 June 2011 4:36:46 am
You might want to try out the ezwebservicesapi extension: it gives you webservice access to all existing fetch functions...
Principal Consultant International Business Member of the Community Project Board