Making a big grid

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
antubis
Forum Newbie
Posts: 16
Joined: Sun Apr 30, 2006 1:48 pm
Location: Pavlikeni, Bulgaria
Contact:

Making a big grid

Post by antubis »

Hello,

I should create a very big grid - 4000 small boxes. But this is very resource-eating process. The site become 400K big ... wow. And every browser stop responding for the time of the loop. Can u tell me how can I create this grid with small resources? Maybe to do this on client side with JS ... but I don`t have an idea how can I do this.

Thanks to all!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That size grid will be large no matter how you create it.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What is your current process? Post code if you have any.
User avatar
themurph
Forum Commoner
Posts: 76
Joined: Wed Apr 19, 2006 1:56 pm
Contact:

Post by themurph »

IF all 4000 items do not have to be displayed at one time on one page, you use a Pager function/class to display them in blocks.
antubis
Forum Newbie
Posts: 16
Joined: Sun Apr 30, 2006 1:48 pm
Location: Pavlikeni, Bulgaria
Contact:

Post by antubis »

The idea is to hide a background images with many boxes ( 4000 ). When user click on image he can post a message ot this box, and the box will become transparent. The background image slowly will be displayed.
So .. you said there isn`t any user-friendly way to create this?
User avatar
themurph
Forum Commoner
Posts: 76
Joined: Wed Apr 19, 2006 1:56 pm
Contact:

Post by themurph »

What are the dimensions of each box? How many bytes is each sectional image?
I'd say optimize the crap out of every image involved.. and try and scale down the
number of cross-sections you are cutting up. (400 boxes instead of 4000).

Still not 100% sure what you are trying to do...
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Post by panic! »

have you considered *shudder* Flash?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

If you are trying to actually offer 4000 different content squares, you are going to be up against one heck of a task in optimizing that thing. Especially after you start throwing content attached to it. Imagine running a loop to display 4000 squares, and within each square having to check whether their is something that needs to be displayed in that square.

Now imagine that you have traffic and that script is being called by, say, 1000 concurrent users. That could pose some problems.
antubis
Forum Newbie
Posts: 16
Joined: Sun Apr 30, 2006 1:48 pm
Location: Pavlikeni, Bulgaria
Contact:

Post by antubis »

Yep ... the situation is the same as you describe it. Can u tell me some alternatives? I have somethink in mind.
1. In the begining of opening the page, there is a flash with a preloader. I can attach the html returned from php script to another JS preloader, so it will be cached when u try to open it.

2. With a cron-job in every 10/30 mins a html file will be destoried, and on its place a new one will be created.

3. To create this grid on client-side - with JS. A loop for 4000 appendChild is fast, but I don`t know how to give a "<a href"> param to already created div.
If you think someone of this can solved my problem, all you have a better decision, please, share it with me.

Regards,
Marush Denchev
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I can't think of a fast way to do this. Of course, I am operating on very little caffeine right now, but if I come up with anything I will be sure to post back.

This just seems like a very intense operation for the code, more than anything because there is a lot of output to manage and the time it takes to do that could exceed the time that your users would want to spend watching it
Post Reply