classes in PHP - question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dan

    classes in PHP - question

    Hi,

    //I've the class Application
    class Application...

    //I call show function from class Abstract
    ...
    $seller = new Seller...
    $seller->show(...)
    ...
    $customer = new Customer...
    $customer->show(...)

    //I've also the class Abstract - it implements some common code code
    for all classes Seller, Customer,... etc..

    class Abstract...
    ...
    function show(...){
    ...

    $form = new HTML_QuickForm. ..

    $this->List($form);
    }


    //here's Customer class - some special code for customer

    class customer extends Abstract

    function List($form){
    $quickFormSelec t = new HTML_QuickForm_ select
    ...
    $form->addElement($qu ickFormSelect)) ;
    }

    of course, I can do it, using some "if's" i Abstract class, but the
    above code could simplify my application, unfortunately it doesn't work

    Any suggestions about this code?


    ps.

    the above code can looks like this:

    ....

    function Lista(){
    ...
    $quickFormSelec t = new HTML_QuickForm_ select
    ...
    return $quickFormSelec t;
    }

    //and then in Abstarct class

    $form->addElement($th is->Lista());


    but in this solution I can add only one $quickFormSelec t do $form, how
    to add some more $quickFormSelec t calling function List only one (like
    in my unfortunetly non working code - $this->List($form); )



    Daniel
  • Oliver Grätz

    #2
    Re: classes in PHP - question

    dan schrieb:[color=blue]
    >
    > Any suggestions about this code?
    >[/color]
    No, because I totally lost you. The code sample ist so split into pieces
    that I can't even imagine waht you are trying to do. Please give code in
    a single piece and describe more clearly what you want it to do.

    AllOLLi

    Comment

    Working...