Actually, it wouldn't add much back into the bandwidth, since you basically take the style code and place it in the <head></head> section. It would do an extra database call I guess, plus the extra packaging in vbscript to make the ASP spit out the result.
It could also be done via FSObjects... but anyone with a hosted site would be out of luck.
============================== Snitz n00b but not for long! ==============================
The benefit of having the CSS in an external file is that it can be cached by the readers browser. In this case, it is not necessary to send the whole style sheet for every page view. This represents quite a saving in bandwidth.
Thanks again for the setup.asp update. I installed it using MySQL and all seems great.
A few questions for you;
The bottom line for doing this is to increase the response time!
Using LB_CSS snitz with MySQL, I noticed about 10 tables are opened, and kept open! Who controls this process? Is there a way to drop the connection after the user leaves?
The reason I’m asking is that we are planning to have several forums installed on one server. Not all of these forums will have continuous usage. However, if even one person uses each forum, then the connections to tables are opened AND kept open!
Does anyone know how to close these connections to MySQL?
This mod only reduces the data passed between the host and web client. Any increases in response time could be considered a side-effect of the process.
DB connection strategies is a whole other area. I'm pretty sure it got a whole lot better with the last major release of Snitz though (3.4xx).
My personal suggestion for improving this is to get all the data from the DB, store it to arrays, close the connection and build the page. This method minimises the DB connection time. But that would be a whole other MOD....
Access and MySQL handle connections in a much different way ssnapier, so to answer your question no, it doesn't really apply to access as well.
However ... If your forum is a rather busy one and you have a lot of concurrent users then access may not be the best choice of database for you to use, you might want to consider upgrading to MySQL or MS SQL if your host allows it.
on search.asp there is still the combobox for members, if you wanna search for something on a member you'll probably know his/her name allready. and.. if you still want to use that combobox you can also select postcount from the membertable and then show only the members who have a postcount of more than 0. why showing members who haven't posted yet :D
If you think you can or you think you cannot, you are right. - Henry Ford
In inc_header.aps there is a chunk of Javascript code. Perhaps you could make this a separate file so the browsers can cache this data.
I thought that was one of the main bandwith problems with Active Server Pages - even if an image, .js, or .css file has already been downloaded, the server serves a new copy whenever the page script is called. It's only when the .asp page itself is cached, that it won't reload all these.
That may be one of the main reasons bandwith becomes an issue for the forum, because all the images are served fresh every page.
The browser is in control of caching, not the server side scripting language. To the browser a .asp page is no different than a .htm page.
The problem with the snitz forum using bandwidth is all the font face, font size, align, bgcolor, etc. tags when looping thru the code. CSS will eliminate the need for these redundant tags and thus reduce bandwidth used to deliver content to the end user browser.
Can be replaced by the following: <tr class=tableFormat> <td> Hello 1 </td> <td> Hello 2 </td> </tr>
Now, multiply that by several times because of all the characters you've removed from each and every row of data in your page output and you've saved some serious bandwidth.
I recently converted one of my applications (a race results reporting system) to CSS. I was able to cut bandwidth by over 70% on average. Pages with large tables & heavy formatting before CSS, downloads could easily be in the neighborhood of 500k. After implementing CSS & removing unnecessary source formatting (tabs & spaces) those pages would typically be under 100k - a HUGE improvement for both me (because of webhosting requirments) and my users (download time & client memory utilization)
The browser is in control of caching, not the server side scripting language. To the browser a .asp page is no different than a .htm page.
That's not true, 86atc250r.
Set one of your .asp pages to cache and it will cache as will all the images and linked files that come with it. But for pages that you don't want to cache (like a forum that is constantly updated), it will load the page from the server every time. That's fine - except, the server serves a fresh copy of every file linked from your .asp page as well: .gif, .jpg, .js, .css, even if the server and browser indicate that the image or script file or stylesheet hasn't changed since last time it was downloaded and it's sitting in the browser cache.
Check your log files - your users are downloading all your images every page view, even if they are in their browser cache.
Reducing your code reduces bandwith sure. But, if you have 30-40k of .js, .css and image files linked to your page, they are being downloaded fresh with every page, not called from the local cache. Get rid of avatars - limit your images to the bare minimum, and reduce the size of as much as you can.
This is a known issue with .asp, I think. I'm just trying to find out if it has been fixed in later releases of .asp and IIS.
PDM71 - I'm not sure I agree with that as I've had to put "anti-cache" variables on the end of images to prevent browswer caching - i.e. <img src="image.gif?nocache=a_random_number"> -I've also been forced to "reload" upon many occasions to get fresh page content, especially when testing.
It's true that there are headers you can set to try to prevent browser caching, but the browser will cache whatever it wants in the end, depending on user settings & browser cache strategy..
The webserver does not "serve" or "push" images, linked JS, or linked CSS - it presents the browser with html code which points the browser to such files and allows the browser to choose whether or not to download fresh copies of the items or not.
What you are describing sounds more like a browser issue than a server side scripting issue. Again, with .asp pages, the server side code executes strictly on the server - the output is plain HTML to the browser and is treated as such.
With the dynamic nature of .asp pages, it may expose browser caching strategy weaknesses much more than plain, static html pages that don't change frequently.
On the css subject - In a script that generates a lot of repeating html like a messageboard or a datafilled table of any sort - CSS can be used to eliminate a ton of redundant code. For instance, I use 533 bytes of CSS in one of my scripts that many times eliminates several hundred Kilobytes of downloaded html code for my end users. There is a lot of value in that, no matter if the browser caches the 533 bytes of linked CSS or reloads it.