i want to render one of these sets of views:
- head
- body-$id1
- foot
OR
- head
- body-$id2
- 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?