[FX.php List] Creating Reusable Code
Jonathan Schwartz
jonathan at eschwartz.com
Sat Sep 9 09:54:22 MDT 2006
Hi Folks,
I'm attempting to get more efficient with scripting.
My first step was to remove hard-code field names from my favorite
search and display script, creating variables for each field and
defining those variables at the top of the document. This works
great. Now, I can re-purpose the script for another db and layout by
just changing the field variables at the top of the page, instead of
ripping apart the entire document.
The second area I'm looking at is to reduce the repetition of
repetitive code (example below actually has 10+ iterations) and use
an iterative loop to accomplish the same, counting from 1 to n lines.
Is that possible/reasonable/reccomended/etc?
Thanks
Jonathan
<tr class="ver10" valign="top">
<td><input name="<? echo $term1; ?>" type="text" id="<? echo
$term1; ?>" size="<? echo $termwidth1; ?>"></td>
<td><input name="<? echo $term2; ?>" type="text" id="<? echo
$term2; ?>" size="<? echo $termwidth2; ?>"></td>
<td><input name="<? echo $term3; ?>" type="text" id="<? echo
$term3; ?>" size="<? echo $termwidth3; ?>"></td>
--
Jonathan Schwartz
FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance
Schwartz & Company
jonathan at eschwartz.com
http://www.eschwartz.com
http://www.exit445.com
415-381-1852
More information about the FX.php_List
mailing list