Posted on November 15th, 2007 by Jans
When developing a PHP application or monitoring a web server, it’s important to know what your server load is to properly identify that there is a problem.
For those interested, there is a very easy way to output your load in PHP using the exec function.
See the code below.
$load = exec(”uptime”);
$load = split(”load average:”, $load);
$load = [...]
Filed under: PHP | 1 Comment »
Posted on November 14th, 2007 by Jans
This is a continuation to my previous post Need for speed : CSS. I have used PHP to compress my JavaScript files.
Why compression and How?
Javascript files for larger sites can become pretty large themselves. Gzipping or compressing these files has shown to provide a reduction in the neighborhood of 70-80% of the original file size, [...]
Filed under: JavaScript, PHP, Tips & Tricks | No Comments »
Posted on November 13th, 2007 by Jans
A powerful advantage of using PHP is that you can compress your files so that they take up less room on your server. There are multiple ways of achieving this, one method is as follows:
<?php
ob_start(“ob_gzhandler”);
?>
Just add that to the very beginning of main.php or global.php or whatever. Right now the file may be very small [...]
Filed under: Css, PHP, Tips & Tricks | 1 Comment »
Posted on November 12th, 2007 by Jans
Version your JavaScript
====================
Include js version in the language attribute, e.g. script type=”text/javascript” language=”JavaScript1.4″>
Useful if you want to “hide” code from older browsers .g. if you use try…catch statements (v 1.4)
Variables
=======
Always declare variables with var this is just good consistency, and not doing so CAN cause errors in certain situations (it’s a scope issue).
End of lines
==========
Please, [...]
Filed under: JavaScript, Tips & Tricks | 2 Comments »