Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to optimize HTML code for loaded faster ?


shpy

Recommended Posts

1st. I browse and "save as" my site (example is home page) to hard disk. The name of file is : homepage.html and it have a folder (with images and js in this). The size of homepage.html is 60KB . That's mean, when a user browse my site (the homepage), he will load 60kb and the folder.

2nd. I come to here

http://www.iwebtool.com/html_optimizer

and paste all my homepage.html 's code to there. I use the optimizer funtion. After that, i have the code and when i save it to a new file (example is homepage2.html) , the size only 35Kb.

 

That's mean, my site when generate the html code, he had generated many unuse code. If we can remove that unuse code, uor site can be loaded faster and faster.

 

Somebody have any idea to help me ?!

Paint for VietNamese :

Link to comment
Share on other sites

1st. I browse and "save as" my site (example is home page) to hard disk. The name of file is : homepage.html and it have a folder (with images and js in this). The size of homepage.html is 60KB . That's mean, when a user browse my site (the homepage), he will load 60kb and the folder.

2nd. I come to here

http://www.iwebtool.com/html_optimizer

and paste all my homepage.html 's code to there. I use the optimizer funtion. After that, i have the code and when i save it to a new file (example is homepage2.html) , the size only 35Kb.

 

That's mean, my site when generate the html code, he had generated many unuse code. If we can remove that unuse code, uor site can be loaded faster and faster.

 

Somebody have any idea to help me ?!

 

all that tool does is remove whitespace from your source, your html code is still the very same.

Treasurer MFC

Link to comment
Share on other sites

Yes, that is. After remove white space and somethings not use, the code is smaller, about 2/3. With that thing, user can load code page faster. Is there any contribution do that for the output html code?

Paint for VietNamese :

Link to comment
Share on other sites

Yes, that is. After remove white space and somethings not use, the code is smaller, about 2/3. With that thing, user can load code page faster. Is there any contribution do that for the output html code?

 

well, you either be more carefull what you echo out

 

or you can put your entire page in an output buffer and use a compress function on that before sending it out.

 

function compress_buffer ($buffer) {

# Return the compressed buffer

$strip_array = array("\n");

return str_replace($strip_array, ' ', preg_replace('/\>\s+\</', '> <', $buffer));

}

Treasurer MFC

Link to comment
Share on other sites

I'm not a coder, i'm only a user. I just can do everything folow the contributions's intruction. So, please giude me where to add it. I already have a funtion like that in gzip_compression.php. Thanks.

Paint for VietNamese :

Link to comment
Share on other sites

I'm not a coder, i'm only a user. I just can do everything folow the contributions's intruction. So, please giude me where to add it. I already have a funtion like that in gzip_compression.php. Thanks.

 

yes but gzip_compression.php is not used if zlib compression is activated in php.ini

Treasurer MFC

Link to comment
Share on other sites

so, how to add this funtion into my site ? (in case gzip is not use).

I found that google code page is optimized with there is no white space. I think that help the page is loaded faster.

Paint for VietNamese :

Link to comment
Share on other sites

so, how to add this funtion into my site ? (in case gzip is not use).

I found that google code page is optimized with there is no white space. I think that help the page is loaded faster.

 

I basically use this in application_bottom :

 

echo compress_buffer(ob_get_clean());

Treasurer MFC

Link to comment
Share on other sites

You really can't use a HTML optimiser as a guide when the whole thing is done on PHP either. It just doesn't work that way. HTML does what it is told, PHP can figure things out...

 

Rob

Rob Bell - Inspired Graphix

Customising osCommerce in Australia, and the world!

View my profile for web and email links.

 

I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture.

However viewing my profile may provide links to my website or something like that which you may find useful.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...