Hey guys, I just noticed that a php library I've included to detect browser enviornments becomes useless when caching is enabled. I've searched around but the closest answers are still outside the scope of my problem.

I have this included in the head of the page.tpl.php file:

<?php
    include('env_detect.php');
    $what_os = browser_detection('os'); 
    $what_browser = browser_detection('browser');
    $browser_num = browser_detection('number');
    $dom_safe = browser_detection('dom');
    $win_ie56 = ( $what_os == 'nt' ) && 
        ( $what_browser == 'ie' ) && 
        ( $browser_num >= 5 ) && 
        ( $browser_num < 7  );
?>

<?php if ($what_os == 'nt') { ?>
    <style type="text/css" media="all">@import "win.css";</style>
<?php } ?>

<?php	if ($win_ie56) { 
    $ie7_dir = $scripts_dir .'ie7/';
?>
    <style type="text/css" media="all">@import "win-ie.css";</style>
    <script src="ie7-combined.js" type="text/javascript"></script>
    <script type="text/javascript">
        var PNGuin_Transparent_GIF = 'blank.gif';
    </script>
    <script src="alphaloader.js" type="text/javascript"></script>
<?php } ?>

With cache enabled it will go through all the arguments for the first visitor and then cache it for everyone else. It's supposed to be dynamic but the drupal cache breaks it. There are other bits in the body that are related to this too. The caching encompasses way too much. For now the caching is disabled.

So, is there a way to selectively prevent caching? All I need to know. I appreciate your answers.

Comments

dvessel’s picture

I tried ob_gzhandler for compression and it breaks miserably so, for now I enabled zlib compression. Not what I was looking for but it's better than nothing.

Inside php.ini:

output_buffering = Off	
output_handler =	
zlib.output_compression = On

Only if there was a way to be selective about what to cache.

-joon
www.dvessel.com