This is another one of those posts that exists as a record for me so I can find it again if i need it!
If you need to know whether a view helper exists before you call it, one way is to write a simple view helper to tell you:
class App_View_Helper_HelperExists extends Zend_View_Helper_Abstract { function helperExists($name) { return (bool)$this->view->getPluginLoader('helper')->load($name, false); } }
You can then use it in a view scripts like this:
<?php if ($this->helperExists('doMagic')) { echo $this->doMagic(); } ?>
As Jeremy mentions in the comments, this code came out of a discussion on the PHPNW IRC channel #phpnw


