Forum Moderators: coopster
I currently use the UDASSS style switcher (PHP style switcher and a degradable AJAX front end) and wanted to use PHP Speedy to improve the load times of the site, the problem is both want to be at the top of the execution order in the script, if I put Speedy anywhere in or above the head tags (it's supposed to go before the doctype) the CSS breaks.
Here is the code in question without the Speedy code:
(I've removed some the script calls UDASSS needs to make the example shorter.)
<?php
require_once('utils/style-switcher.php');
$styleSheet = new AlternateStyles();
$styleSheet->add('css/styledark.css','screen,projection','Dark');
$styleSheet->add('css/stylelight.css','screen,projection','Light',true);
$styleSheet->getPreferredStyles();
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type='text/javascript' src='js/prototype.js'></script>
<script type='text/javascript' src='js/alternateStyles.js'>
<?php $styleSheet->drop(); ?>
</head>
Style Switcher requires the first 5 lines of code to be at the top of the document, PHP Speedy requires the following lines to be at the top:
require_once('class.compressor.php'); //Include the class. The full path may be required
$compressor = new compressor('css,javascript,page');
Does anyone know how I could get the two to place nicely together?
[edited by: eelixduppy at 7:14 pm (utc) on July 31, 2008]
[edit reason] removed links [/edit]
Eelix: Sorry about the links, I made sure not to have any links to the site, or anything that could be used to identify it and then completely forgot the rule at the end. Used to people getting annoyed if somebody doesn't post links to something they're talking about.
[edited by: Sigmund_Fraud at 9:43 am (utc) on Aug. 1, 2008]
I look at this and wonder if the answer is there
$compressor = new compressor('css,javascript,page');
I wonder what compressor does with css? maybe just remove it, maybe not.
a look into the compressor function should give you a clue