| Posted by Wescotte on 04/17/06 21:52 
That is exactly what I did in my current version but I wanted a cleanermethod.
 
 In the case you described above I would have to have to modify multiple
 sectiosn of code to add a new class type instead of simply adding a new
 row to a table that contains the code for a new type. I guess the only
 method I can see would be again going by functions but having a prefix
 to each say
 
 Fedex.php
 Fedex_Detected_EDI_Type()
 Fedex_Parse_EDI_File();
 Fedex_Create_Remittance()
 
 DHL.php
 DHL_Detected_EDI_Type()
 DHL_Parse_EDI_File()
 DHL_Create_Remittance()
 
 while (odbc_fetch_row($result) || $done) {
 $function = odbc_result($result, "name") . "_Detected_EDI_Type";
 if ($function()) {
 // Detected edi file format
 // do something....
 $done = true;
 }
 }
 
 With this method I can create a table that contains the source code
 filename
 and the leading characters into the function name so that each name is
 unique
 
 Now to add a new type I simply add a new record ot the table rather
 than adding a new case "formatX": instance in the detcting/pasing and
 creating remittance sections
 which allows me to isolate the code from the user yet allow them to
 create code for new file types
 
 While this method will work I was looking for a way to keep the
 function names identically instead of having a leading unique string +
 function name (Fedex or DHL) _Detected_EDI_Type
 
 Basically I was looking for the ability to include "code.php" and then
 somehow uninclude it after I used it.
  Navigation: [Reply to this message] |