- 10/22/13 11:52:17 (16 months ago)
- 1 edited
r758706 r791761 62 62 == Changelog == 63 63 = 1.4 = 64 * Replace legacy mfunc/mnclude/dynamic-cached- datafunctionality with a "wpsc_cachedata" cacheaction filter. 64 * Replace legacy mfunc/mnclude/dynamic-cached- functionality with a "wpsc_cachedata" cacheaction filter. 65 65 * Added dynamic-cache-test.php plugin example wpsc_cachedata filter plugin. 66 66 * Misc bugfixes. … … 385 385 386 386 WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated html. 387 The function that hooks on to the wpsc_cachedata filter should be put in a file in the plugins folder unless you use the late_init feature. An example plugin is included. Edit [dynamic-cache-test.php](http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) and uncomment the code, and set the constant 'DYNAMIC_CACHE_TEST_TAG' to a random string that will not appear on your website. Change to PHP or legacy caching and activate dynamic caching on the Advanced Settings page and clear the cache. You should see the current server time in a html comment in the source code of your page. More details [in this post](http://ocaoimh.ie/y/5b). 387 The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit [dynamic-cache-test.php](http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) to see the example code. 388 There are two example functions there. There's a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn't matter when serving cached pages. See [this post](http://ocaoimh.ie/y/6j) for a more technical and longer explanation. 388 389 To execute WordPress functions you must enable the 'Late init' feature on the advanced settings page. 389 390 390 391 = How do I use WordPress functions in cached dynamic pages? = 391 392 See the next qestion, you have to load WordPress before the cached file is served. 393 394 392 = How do I delay serving the cache until the "init" action fires? = 395 393
Note: See TracChangeset for help on using the changeset viewer.