How to reduce file size.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

How to reduce file size.

Post by someberry »

I was wondering around the internet (As you do) when I came across http://ag2.avidgamers.com, which has exceptionally small page sizes. I even copied the code (View-source) and uploaded it to my server, and the diference was 3-4 times the size.

I was wondering how they were able to get their file sizes so small, and if I could do the same.

Thanks,
someberry.
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

They basically use a lot of CSS in external pages to make the layout work, so that the HTML in the page doesn't have to (and they can concentrate on the content). External CSS only has to be loaded once, and it obviously results in smaller main pages.

Code: Select all

<style type=&quote;text/css&quote;>
<!--
@import 'layout.css';     /* two import statements to work */
@im\port &quote;layout.css&quote;;    /* around problems with IE on mac */
-->
</style>
Nothing to do with PHP, but meh.
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

Post by someberry »

So how come when I upload only the HTML, it is still 3-4 times the size, even though it is exactly the same?
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

Ah, I see what you're getting at.

I'd assume that they have page compression (such as mod_gzip) enabled on the server. As I understand it, the pages are the regular size on the server, but they're compressed by Apache before being sent out to the browser.

I don't have a clue about how to go about enabling it though.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Post Reply