in reply to Re^2: Foreach Loop Optimization
in thread Foreach Loop Optimization

$output = $output . "<td$recentChange><div title=\"Changed by $moduleF +ie ld[1] at $localtime\" class=table_data onClick=\"ToggleShowHide('label +_$headers[$dataCount]$moduleCount','$headers[$dataCount]$moduleCount' +)\" id=\"label_$headers[$dataCount]$moduleCount\" style='display: blo +ck;'>$moduleField[0]</div> <div id=\"$headers[$dataCount]$moduleCount +\" style='display: none;'><input type=text name=\"$headers[$dataCount +]$moduleCount\" value=\"$moduleField[0]\"><input type=button onClick= +\"ToggleShowHide('label_$headers[$dataCount]$moduleCount','$headers[$ +dataCount]$ moduleCount')\" value=OK></div></td>";
.... is pretty darned ugly (no offense intended).

You could tidy that up somewhat, and make it a bit more readable, by doing something like:

$output .= qq( <td$recentChange> <div title="Changed by $moduleField[1] at $localtime" class=table_data onClick="ToggleShowHide('label_$headers[$d_cnt]$m_cnt','$h +eaders[$d_cnt]$m_cnt')" id="label_$headers[$d_cnt]$m_cnt" style='display: block;'> $moduleField[0] </div> <div id="$headers[$d_cnt]$m_cnt" style='display: none;'> <input type=text name="$headers[$d_cnt]$m_cnt" value="$mod +uleField[0]"> <input type=button onClick="ToggleShowHide('label_$headers[$d_cnt]$m_cnt' +,'$headers[$d_cnt]$m_cnt')" value=OK> </div> </td> );
Notes:

Hope this helps,
Darren :)

Replies are listed 'Best First'.
Re^4: Foreach Loop Optimization
by upallnight (Sexton) on Aug 06, 2007 at 14:02 UTC
    Thanks, I took your advice and cleaned up the readability.

    I still am looking at the html output to see if I can speed up the browser rendering. I took out the javascript and input form fields, but its still taking as long to load the page.
    It must be the table with 750 rows of data thats bogging the browser down.