At controller I want to use add data in foreach

foreach ($photos as $photo){ $this->view->setVar("addGenre",$photo->genre); $addGenre .= $photo->genre."/"; // 1. here occur some problem $i++; }

upper line $addGenre .=  <== I want to use this method. but error 

Undefined variable addGenre

used it 
but way..

please help me... thanks

  1. Rewrite better the post, it's hard to read.
  2. You are setting a view variable, not a normal variable. they are totally different.
  3. Aren't you looking for $this->view->setVar("addGenre", $photo->genre . "/")?