WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Set cached file to PHP rather than HTML? (2 posts)

  1. johnasp
    Member
    Posted 2 years ago #

    Is it possible to set WP-SUPER CACHE to spit out its cached file with a PHP extension rather than HTML? Reason I ask, is that I have some server side PHP script which I need to execute upon every page refresh. The script basically detects the user-agent string and stores this value in a variable. I then print the value of this variable in the <BODY> class, see below:

    backticks

    // Figure out which browser the user is using

    $user_agent = $_SERVER['HTTP_USER_AGENT'];

    if (preg_match('/Firefox/', $user_agent)){
    $browser = "ff";
    } else if (preg_match('/Firefox.3.0/i', $user_agent)) {
    $browser = "ff ff30";
    } else if (preg_match('/MSIE.9/i', $user_agent)) {
    $browser = "ie ie9";
    } else if (preg_match('/MSIE.8/i', $user_agent)) {
    $browser = "ie ie8";
    } else if (preg_match('/MSIE.7/i', $user_agent)) {
    $browser = "ie ie7";
    } else if (preg_match('/MSIE.6/i', $user_agent)) {
    $browser = "ie ie6";
    } else if (preg_match('/Chrome/i', $user_agent)) {
    $browser = "chrome";
    } else if (preg_match('/Safari/i', $user_agent)) {
    $browser = "safari";
    } else {
    $browser = "in_unknown";
    }

    <body class="<?php echo $browser; ?>">
    backticks

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    You should be using the dynamic php capability of the plugin. See the documentation on using it as this is exactly what it's supposed to do.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic