Forum Moderators: coopster
I am calling a script using php's virtual() function, which works in the same way as adding <!--include virtual="".. to a page. This works nicely and my site is working well.
I'm looking for a way to speed up some of the index pages, which call a script several times. I've tried caching the output using cache_lite, cgi_cache and several other hotscripts scripts, but each has the same problem. They all cache the page up to the point where virtual() is called, then stop. Until the cache timer runs out, only the top fragment of the page is displayed. The full page then displays, but only once, and if the page is refreshed, only the top fragment again.
Has anyone seen this problem and know of a reliable way to cache pages that are called in this way?
Thanks,
Don
It seems that you have two options, assuming you use cache_lite:
Call $cache- >end() before calling virtual() and cache->start() with a different id after that. The problem with this is that the output of the CGI will not be cached.
Alternatively, use Pear's HTTP_Request to generate a real request to the CGI as opposed to a virtual subrequest. Fetch the output into a string and echo that string. This is the more elegant solutions because the CGI output is cached as well but it might be tricky to setup the query string, http headers and the request body (POST vars) for the CGI request.