• Resolved nast0

    (@nast0)


    Hey all,

    First off; WP 2.8.4 / WSC 0.9.6.1 / Dedicated Server

    I’ve suddenly got the need to cache pages on my WP blog, as my traffic has jumped 500%, and with no caching server load is a constant ~5. This morning I did the upgrade to 2.8.4, and installed wp-super-cache.

    I use a traffic trading script on my site which requires I embed a php statement to count incoming hits on all pages. Historically I’ve done this in *.com/index.php with no problem. After enabling WSC I found it isn’t counting all incoming hits, only *some*.

    Here’s the settings i picked, and why;

    Only cache posts (is_single) – 95% of my site are posts
    Exclude “index\.php” & “index” – This is where my php call is
    Caching is 1/2 on – I don’t use fancy permalinks, and want the php engine to be called

    If I view the source of my homepage (or a PAGE), I see the php snippet I included, but if i visit a POST, I see nothing. Should it not be the case that index.php is untouched by WSC? And the code carries through to all pages and posts?

    Thanks in advance,
    n

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nast0

    (@nast0)

    A little more clarity is probably worthwhile here.

    index.php carries a php statement, but ultimately what it does is embed a javascript snippet in the output to a user. Here are the calls, and the last 8 lines of each page/post.

    Call made in index.php:
    virtual ("/cgi-bin/at3/in.cgi");

    Output made to is_front, is_paged etc:

    </body>
    
    </html>
    
    <script type="text/javascript">
    <!--
    document.cookie='atref=MYSITE.com$#; path=/;'
    // -->
    </script>

    This output does not appear on any single posts, is_single, /?p=123456.

    WP Super Cache, whether “on” or “half-on”, caches blog page renderings, so if you require that a blog page is rendered (e.g., the virtual() is run) on each blog page load, then you cannot have WPSC cache that blog page.

    (I’m talking about any blog page here, not Pages.)

    It’s the same situation as those “Most Visited Pages” plugins. WPSC cannot cache them because their code needs to be run on every blog page load.

    The index\.php exclusion is for something else.

    However, if you insist, there’s a mod you can do. You can make WPSC run your own PHP after it readfiles the page HTML from the ‘half-on’ cache. Add your PHP before the die(); on line 109 of wp-cache-phase1.php.

    if ( $meta[ 'dynamic' ] ) {
    	include($cache_file);
    } else {
    	readfile( $cache_file );  // <-- readfile from cache/
    	}
    // <-- add your PHP here. Go crazy.
    die();

    I hope this helps.

    Thread Starter nast0

    (@nast0)

    I gotta hand it to you, it’s a perfect solution. I had a feeling the php engine was still called when caching is half on, and using this mod I can track incoming visitors… with no noticable impact to server load. In fact… I can cache the entire site now! Reducing load even further!

    Thanks for taking the time to help.

    I assume I’ll be able to get away with this in future releases of WSC?

    Got a question about that Pinoy.ca (or anyone else). I’m running some dynamic code in a file, and I’m including it in the theme’s functions.php so that I can use those variables in the theme. Would I be able to include that same file here (thus removing it from functions.php)? I’d check now but am on my phone.

    That’s always been an issue for me, I have revenue sharing code that I’d like to run in the sidebar – but just can’t because it has to use rand to get the right ad code to display and I don’t want to stick the same code in every cached pageload.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Super Cache] WP-Super Cache, Traffic Trade Scripts, and Exclusions’ is closed to new replies.