I currently do it this way (to check if Layout Front Controller plugin has been registered for example):
$front = Zend_Controller_Front::getInstance();
if($front->hasPlugin('Zend_Layout_Controller_Plugin_Layout')){
//....do something
};
IS this a good way? are there any other ways to check it?
You already ask the front controller if it has the plugin registered, I think this is straight enough and there is nothing wrong with this. You could just make it a little shorter:
if (Zend_Controller_Front::getInstance()->hasPlugin('Zend_Layout_Controller_Plugin_Layout')) {
//....do something
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.