I use CSSTidy to optimise and to parse the CSS code.
I
In pfc 0.6, when the user want to overload the css stylesheet we can have something like that:
- Code: Select all
div#phpfreechat_container {
border: black solid 1px;
color: #338822;
background-color: #d9edd8;
background-image: url(demo/phpfreechat/trunk/data/public/images/shade.gif);
background-position: right;
background-repeat: repeat-y;
padding: 10px;
min-height: 20px;
}
.....
div#phpfreechat_container {
background-color: #FFCC00;
background-image: url(/mypath/mypersonnalimg.gif);
}
CSSTidy permits to optimise it
Here is the operation to optimise it :
Upload CSSTidy library
Dowload CSSTidy-1.1 here, and upload the csstidy-1.1 folder in the /lib/ directory of PFC. (It is possible to delete the Docs and testing directories).
Modify the /src/phpfreechatconfig.class.php file
After (line 62 in pfc 0.6)
- Code: Select all
$this->default_params["xajaxpath"] = dirname(__FILE__)."/../lib/xajax_0.2_stable";
Add
- Code: Select all
$this->default_params["csstidypath"] = dirname(__FILE__)."/../lib/csstidy-1.1";
Modifiy the /src/phpfreechat.class.php file
Replace the current printStyle function (line 127 in PFC) by
- Code: Select all
function printStyle()
{
$c =& phpFreeChatConfig::Instance();
$smarty =& phpFreeChatTools::GetSmarty();
$c->assignToSmarty($smarty);
require_once $c->csstidypath."/css_parser.php";
$css = new csstidy();
$css->set_cfg('remove_last_;',TRUE);
$css_code = $smarty->fetch("style.css.tpl");
if ($c->css_file)
$css_code .= $smarty->fetch($c->css_file);
$css->parse($css_code);
echo "<style type="text/css">n";
echo $css->print_code(NULL,true);
echo "n</style>n";
}