Connecting Tech Pros Worldwide Forums | Help | Site Map

classes in PHP - question

dan
Guest
 
Posts: n/a
#1: Jul 17 '05
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){
$quickFormSelect = new HTML_QuickForm_select
...
$form->addElement($quickFormSelect));
}

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(){
...
$quickFormSelect = new HTML_QuickForm_select
...
return $quickFormSelect;
}

//and then in Abstarct class

$form->addElement($this->Lista());


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



Daniel



Oliver Grätz
Guest
 
Posts: n/a
#2: Jul 17 '05

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
Closed Thread


Similar PHP bytes