WordPress.org

Plugin Directory

Changeset 791761


Ignore:
Timestamp:
10/22/13 11:52:17 (6 months ago)
Author:
donncha
Message:

Updated docs, mostly in the dynamic content section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-super-cache/trunk/readme.txt

    r758706 r791761  
    6262== Changelog == 
    6363= 1.4 = 
    64 * Replace legacy mfunc/mnclude/dynamic-cached-data functionality with a "wpsc_cachedata" cacheaction filter. 
     64* Replace legacy mfunc/mnclude/dynamic-cached-content functionality with a "wpsc_cachedata" cacheaction filter. 
    6565* Added dynamic-cache-test.php plugin example wpsc_cachedata filter plugin. 
    6666* Misc bugfixes. 
     
    385385 
    386386WP 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). 
     387The 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. 
     388There 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. 
    388389To execute WordPress functions you must enable the 'Late init' feature on the advanced settings page. 
    389390 
    390391= 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  
    394392= How do I delay serving the cache until the "init" action fires? = 
    395393 
Note: See TracChangeset for help on using the changeset viewer.