From: Julian F. <ju...@be...> - 2003-03-10 19:29:25
|
On Monday, March 10, 2003, at 11:03 AM, Andre Eisenbach wrote: > Julian Fitzell wrote: > >> in...@us... wrote: >> >>> + printf( "<tr %s>", helper_alternate_class( $row ) ); >>> + printf( "<td width=\"50%%\">%s</td>", $label ); >>> + printf( "<td width=\"12%%\" class=\"right\">%d</td>", $open >>> ); >>> + printf( "<td width=\"12%%\" class=\"right\">%d</td>", >>> $resolved ); >>> + printf( "<td width=\"12%%\" class=\"right\">%d</td>", >>> $closed ); >>> + printf( "<td width=\"12%%\" class=\"right\">%d</td>", >>> $total ); >> >> >> Just a quick note... I believe most of these could use single quotes >> which removes the need to escape the double quotes along with the >> unecessary parsing that goes along with seeing if there are any >> variable expansions in the string. > > > Hmm, I guess I feel it's cleaner this way. Makes it more readable to > me, but I can change it to whatever is more Mantis, no problem. Can > you take one of the lines above though and give me an example of what > it should look like? Thanks. > well we would normally do: printf( '<td width="12%%" class="right">%d</td>', $open ); But I'm curious why you think it's cleaner the other way? With single quotes you don't need to litter your string with backslashes and you know instantly that there is no variable expansion going on. >>> + $query = "SELECT reporter_id, COUNT(*) as num" >>> + . " FROM $g_mantis_bug_table" >>> + . " WHERE $specific_where" >>> + . " GROUP BY reporter_id" >>> + . " ORDER BY num DESC" >>> + . " LIMIT $g_reporter_summary_limit"; >> >> >> double quotes wrap onto the next line so we tend to do this all as >> one string instead of having to put the . and the "" on each line. > > > Sorry, I'll change it to be more Mantis-like. No big deal. Just aiming for consistency. :) Haven't looked at the results of your speed improvements yet by the way but they sound impressive! Julian |