Or...
what you can do though it 'post-load' them. Same idea, but stick images that are on other pages in some JS at the _end_ of the HTML and they'll load after the images on that page are complete. That way, the browser is essentially preloading images for the next page the users is likely to visit (while the user is sitting there reading the page...) It isnt appropriate in all situations, but it can be a useful trick... :) -- Shane On Saturday 15 Dec 2001 7:39 pm, René Fournier wrote: > What you're saying makes sense--that loading ALL the nav button images > for the whole site at once is overkill. In this case, however, it really > isn't, since there are just to 'sets' of nav buttons--the top-level set, > which needs to be preloaded no matter what page the user is on; and the > products subsection set, which SHOULD be preloaded, because every visit > will inevitably visit that section (it is the reason why any visits the > site). I agree that if there were numerous sub-level 'sets' of nav > button images, that loading all of them would be inefficient. > > ...Rene > > On Saturday, December 15, 2001, at 02:08 AM, Charles Williams wrote: > > ----- Original Message ----- > > From: "René Fournier" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Saturday, December 15, 2001 1:27 AM > > Subject: [PHP] Is PHP up to task? > > > >> (Now that I have your attention... :-) > >> > >> Here's the situation: All the navigational buttons in the site I'm > >> working on have three different states (for mousovers--normal, > >> mouseover, onClick). What I don't like: When I mouse over one button, > >> it > >> takes a second or two for the page to fetch the mouseover state of the > >> button from the server. Now, normally, I would just write a > >> preloadimages() function in JavaScript and preload all the button > >> states > >> when the pages load. BUT, this is a little harder, since this is a > >> fairly big site (or will be) and it's not always the same buttons that > >> need to be loaded; they can change from page to page (say, between > >> sections, with subnav bars). That being said, I've kept one thing > >> simple: All the buttons (and their states) are stored in the same > >> directory, and in fact only button images are in that directory > >> ("/nav"). > >> > >> So here's what I would like to know: Is it possible for PHP to read the > >> contents of a directory--all the files--and then take that array and > >> generate some javascript preload() statements? (Of course, I'm sure it > >> IS possible, but I would appreciate any pointers you might have > >> before I > >> undertake it. Maybe there's even a better way than what I can see!) > >> What > >> I was thinking was to preload all the nav buttons and their states in > >> the header.inc. > >> > >> Thanks. > >> > >> ...Rene > > > > Rene, > > > > Of course this is possible. However, I doubt if it is desirable. The > > more > > visitors to your site the larger the load if you load all the graphics, > > because each session would have it's own copy of all the graphics. It > > would > > be better if you checked the page being loaded and passed a list of the > > needed graphics needed to a function that would load ONLY those graphics > > needed for said page. This is not too very difficult and if run on a > > PHP > > caching server then the overhead is not so bad. The hard part is > > getting > > the JS to work correctly (at least for me. hehe. I suck at JS). > > > > For example. http://clans.acnsnet.com is a package I'm working on that > > uses > > templates to control the layout. Each menu item is stored in an SQL > > backend > > as well as the Template info (location, menu type, state, etc....). I > > already have a function to determine what page is active. So finding > > out > > what menu items are visible is simply a matter of comparing the active > > page > > to the array of menu items. I can then determin which images I would > > need > > to load (depending on the template in use). This way I only load the > > images > > that are needed, which saves on load time and memory. > > > > Anyway, have fun. > > > > chuck > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > --- > René Fournier > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]