tags:

views:

108

answers:

2
+1  A: 

You can instantiate dozens/hundreds/X of objects of any kind within the same php instance.
Use a debugger or add more debug (echo) code to find the error.

e.g. using this dummy implementation of the two classes

class CategoryList {
  public $mCategory=null;
  public function init() {
    $this->mCategory = array(
      array('name'=>'Cat A'),
      array('name'=>'Cat B'),
    );
  }
}

class BrandList {
  public $mBrand=null;
  public function init() {
    $this->mBrand = array(
      array('name'=>'Brand A'),
      array('name'=>'Brand B'),
    );
  }
}

your code prints

<a href=''>Cat A<br/></a><a href=''>Cat B<br/></a><a href=''>Brand A<br/></a><a href=''>Brand B<br/></a>

without any problem.

VolkerK
It actually displays both categories and brands with this dummy implementation..
chupinette
Yes, which means: you're barking up the wrong tree ;-) The code you initially posted isn't the cause of the problem.
VolkerK
Ya you are right. Maybe there's is a problem with the way am getting the values from the other class. I have included the code for class Catalog
chupinette
+1  A: 

No, you can create any number of instances even for the same class. Make sure that your both classes are included in your script independently of each other.

Sarfraz
Thanks for your replies..There does not seem to be any error. and yes I have included both classes. But can anyone explain me why when I remove the codes for one list, the other list being displayed? Ive tried so many ways..but can't find a solution to this
chupinette
Without seeing the code for both classes it's pure speculation.
VolkerK