Speeding Up Web Sites with Flushing [PHP Speed Tweak]
Though, you should be careful when using it because it may or may not be helpful, depending on your application.
When a client requests a php (or any other server-side page) the server parses the whole page, then sends the resulting code to the client when it’s finished. Once the client receives the page, it can begin fetching images, or whatever media is on the page.
Using the following flush code could speed up the process for the client:
< ?php flush(); ?>
Be sure to remove the space between the right angled bracket “<” and the question mark “?”.
When the server encounters this tag, it will immediately send everything it’s already processed to the client before continuing on the rest of the page. For example, I use this code on another site right after the 3 codes for the 3 random header images are processed. This way, the client can begin fetching the images while the server processes and sends the rest of the page, which is mostly text.
Ultimately, we’re talking about milliseconds here, but its hundreds of milliseconds we might be shaving off. Again, with the site I mentioned above, it seems that by time the header images have loaded, the rest of the web site has completed it’s load. Not only did this save time for the user, but it gives the appearance that everything loaded at once rather than the page appearing with the header images appearing a few moments later.
Code responsibly.
How to Find Your Server Path [Path to Folder]
Usually, one can just look up their absolute server paths in the help files of their web host. Sometimes your host isn’t so helpful. Just put the following code in a .page and drop it in the folder you want to know the server path to and tada!
< ?php echo getcwd(); ?>
Don’t forget to remove the space between the angled left bracket “<” and the question mark “?”.
Once you do that, send a complaint to your host.
How Margins Work for the IMG Element
I usually use a WYSIWYG editor for getting code out in a hurry, but I’m fairly proficient when it comes to HTML. Today, however, I wanted to force a margin around an image for a buffer but I incorrectly used a parameter of “margin” and assigned a pixel value. What one is supposed to do is use HSPACE and VSPACE.
HSPACE will create a margin of the specified pixel size on the left and right of the image.
VSPACE will create a margin of the specified pixel size on the to and bottom of the image.
For example:
<img src=”http://www.365discoveries.com/images/image.jpg” hspace=”5″ vspace=”3″ />
Will create a 5 pixel margin on the left and right of the image and a 3 pixel margin on the top and bottom of the image.

