2009年9月24日星期四

[fw-mvc] how to check if action or partial exists?

Hi,

I am working on a view helper that loops through a set of given
controller/action values. The rank of this set can be modified by the
user (it's stored in the database). However, not everything needs to be
a 'real' action. It could also be a partial, like a single banner. I
would still like to use the same pairs of data, stating that if the
action 'bar' exists in controller 'foo', I am going to output
$this->view->action('bar','foo'). If it doesn't exist, I'd like to check
if there is a partial called 'foor/bar.phtml' and eventually output
$this->view->partial('foor/bar.phtml'). If this also doesn't exist, I'd
like to throw an exception.

However, I can't find any possibility to check whether a partial or an
action in a given controller exists (from within my view helper or
anywhere else). Can anyone tell me if this is possible at all, and if it
is, how? Thanks in advance!

Kind regards,

Dimitri van Hees

没有评论: