----- Original Message -----
From: "René Fournier" <[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


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.


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]

Reply via email to