I have a form class that creates form elements based on database information. The problem is that the form takes more than 20 seconds to load on my localhost. On the web server it's even worse: the form doesn't load at all because of limited memory resources.
I was hoping you guys could give me some tips on optimizing my form setup. The web application I'm working on is an online park administration tool for a company that repairs playground equipment for its clients. Every few months the company needs to check the status of the playground equipment. They can do that by filling in the form that loads form fields based on a few predefined checkpoints. Eg. "Is there still enough sand in the area around the playground device?" etc. I have a database with a clients table, a playgrounds table, a equipment table and a checkpoints table. Every client owns a few playgrounds. Every playground consists of some devices (equipment). And every device has a few checkpoints that need to be checked. Basically the form displays input fields for every checkpoint for every device for every playground of that particular client. Currently I query the playgrounds table to find all playgrounds the logged in client owns. Then for every playground I display a subform. In the subform I have another subform for every playground device. Then I query the database to find the checkpoints for every device. Based on those checkpoints the form displays some form fields in the devices subform. Of course I use a lot of foreach() loops to be able to display all necessary form fields. foreach($playgrounds as $playground) { $devices = $playgrounds->fetchAll($playgrounds->select()->where('playground_id = ?',$playground->id); foreach($devices as $device) { $checkpoints = $checkpoints->fetchAll($checkpoints->select()->where('device_id = ?',$device->id); foreach($checkpoints as $checkpoint) { //create form fields } } } I found that if there's less checkpoints the form loads way quicker. I was wondering if there's a better way of coding in order to have the form load faster. -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22309252.html Sent from the Zend Framework mailing list archive at Nabble.com.