Reply to Re: Confused about scope of globals in included files

Your name:

Reply:


Posted by Wescotte on 02/23/06 22:03

Here is what I'm actually trying to do. I have several different types
of files the user is loading into the application.
I have several freight vendors and each has a slightly differnet file
type. So I detect the file type and then based on that load a specific
file that sets various constants for this particular vendor and has a
common set of functions.

So something like (sudocode)

$type = Detect_File_Type($file);

switch ($type) {
case: "FEDEX"
include "Fedex.php";
Create_Batch($Batch_Number, $file);
break;
case: "DHL"
include "DHL.php";
Create_Batch($Batch_Number, $file);
break;
default:
echo "unable to process file";
return false;
break;
}

Fedex.php

include "general_batch_functions.php";

Define constants

Function Create_Batch()
{
}

other specific functions for FEDEX file processing


DHL.php

include "general_batch_functions.php";

Define constants

Function Create_Batch()
{
}

other specific functions for DHL file processing

How would you go about doing such a task?

The constants defined in each file aren't needed anymore after the
batch is created.

The only time they are another switch takes place and it's included
again (done for the payment process because most of the constants are
like a remittance address and the bank account numbers to make ACH
payments to and such.) I supose I could simply store these constants in
a database table but because I need specific functions to read the data
it seemed like a better caseto group it all into one file. Any
suggestions on possibly a better design?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация