Zend Framework: how to remove rendered views in the controller?

Posted by takpar on Stack Overflow See other posts from Stack Overflow or by takpar
Published on 2010-03-13T17:56:34Z Indexed on 2010/03/13 18:15 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

i want to render one of these sets of views:

  1. head
  2. body-$id1
  3. foot

OR

  1. head
  2. body-$id2
  3. foot

which set exsists.

i do it like this:

try {
    $this->render("head");
    $this->render("body-$id1");
    $this->render("foot");
} catch (Exception $e) {
    $this->render("head");
    $this->render("body-$id2");
    $this->render("foot");  
}

but it causes the head view be rendered twice if body-$id1 does not exists.

do you have a better solution?

in another saying, may i check the existance of body-$id1 before rendering it?

© Stack Overflow or respective owner

Related posts about zend

Related posts about framework