Re: Is PHP up to task?

From: Date: Sat, 15 Dec 2001 19:39:29 +0000
Subject: Re: Is PHP up to task?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77823@lists.php.net to get a copy of this message
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" <rene.fournier@markada.com> To: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net ---
René Fournier renefournier@yahoo.com

« previous php.general (#77823) next »