Hi 
        I too suggested a way for your previous problem.  
What you are doing is right here, but some corrections are there.

You cannot use 'var' to declare variables inside constructors
rather you could use them only before constructor, and intialize
them inside constructor, look out the below code.

<?php
class form
{
        var $lang ;
        function constructor($language)
        {       
          $lang = $language
        //...... other stuffs
        }
}

In addition you can't intialize them too before constructor.

I hope it will work for you.



On Thu, 28 Feb 2002, Nick Wilson wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> I have an application that spits out a contact form in either English or
> Danish. Someone suggested I use a 'class factory' like the PEAR db
> abstraction layer and that is what I'm doing.
> 
> So I choose the language like this:
> 
> $form = Form::GetFormObject($lang); //different class for each lang
> 
> No problem.
> 
> My question is related to the efficiency of this. 
> 
> It is only the *properties* that are different in each language class
> not the methods so I'm including all the same methods twice! That
> doesn't seem terribly efficient.
> 
> I thought maybe I could init properties with a constructor in a single
> class like this:
> 
> <?
>     function test($lang) {
>         if($lang=="en") {
>             var $lang="English";
>         } else if($lang="dk") {
>             var $lang="Danish";
>         }
>     }
> }
> ?>
> 
> But it fails.
> 
> Is there a better way? It just seems like overkill to include 6-700
> lines of methods /twice/
> 
> Many thanks....
> 
> - -- 
> - -----------------------------------------------------------
>  www.explodingnet.com   |    Projects, Forums and
>                         +    Articles for website owners 
> - -- Nick Wilson --     |    and designers.
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> 
> iD8DBQE8fe0UHpvrrTa6L5oRAgh5AJ9oXAQ4kMwj/neprZOQx1KZmpOWXACdFTiP
> WAFmmGoE60Y079p39i+pCnQ=
> =290x
> -----END PGP SIGNATURE-----
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

<[EMAIL PROTECTED]>
-------------------------------------------------------------------
We must use time wisely and forever realize that the time is 
always ripe to do right."
            
                -- Nelson Mandela
-------------------------------------------------------------------


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

Reply via email to