• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Optimise CSS code

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
2 posts • Page 1 of 1

Postby Nemako » Mon Feb 13, 2006 9:43 am

Here is my contribution,

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";
  }
Last edited by Nemako on Mon Feb 13, 2006 9:47 am, edited 1 time in total.
Nemako
Nemako
Member
 
Posts: 44
Joined: Fri Feb 10, 2006 1:52 pm
  • Website
Top

Postby phpfreechat » Mon Feb 13, 2006 10:20 am

Thanks for this nice contribution, I just integrated it into pfc source code.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top


Post a reply
2 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 8 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub