On Mon, 2002-11-25 at 10:57, Dan Field wrote:
> is it doable?

well I found a way. It's a bit of a hack but FYI heres how it works:


function Form() {
        // a slight hack which allows us to overload
        // constructors by the number of args

        $name = "Form".func_num_args();
        $arg_list = func_get_args();
        $num_args = func_num_args();
        switch($num_args) {
                case 0:
                        $this->$name();
                        break;
                case 6:
                        $this->$name(   $arg_list[0],
                        $arg_list[1],
                        $arg_list[2],
                        $arg_list[3],
                        $arg_list[4],
                        $arg_list[5]);
                        break;
                default:
                        echo "Wrong number of args for constructor!";
                }
        }


       // pseudo-constructor for 0 args
       function Form0() {
                $this->formName = "myForm";
                $this->formAction = $_SERVER['PHP_SELF'];
                $this->formMethod = "POST";
                $this->formVersion = "xhtml";
                $this->formLanguage = "en_gb";
                $this->formStyle = "/styles/form.css";
                $this->formElementCount = 0;
        }

        // pseudo-constructor for 6 args
        function Form6($formName,
                        $formAction,
                        $formMethod,
                        $formVersion,
                        $formLanguage,
                        $formStyle) {
                $this->formName = $formName;
                $this->formAction = $formAction;
                $this->formMethod = $formMethod;
                $this->formVersion = $formVersion;
                $this->formLanguage = $formLanguage;
                $this->formStyle = $formStyle;
                $this->formElementCount = 0;    // don't allow user to
set this
        }

-- 
Dan Field
Systems Development Officer - Social Services Dept.
Ceredigion County Council.



********************************************************************************
Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi,
yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato.
Pe  dderbynioch y neges hon mewn camgymeriad, byddwch
mor garedig a rhoi gwybod i'r rheolwr system.

Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi
cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper.

********************************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

********************************************************************************


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to