简体   繁体   中英

How to check if user is in the main page(Zend FrameWork)

I need to hide some item in the view when the page is main, others page will show this item

so what function i need to use to check if the page is main

you can get the current controller and action name with following code,

$controller = $this->getRequest()->getControllerName();
$action = $this->getRequest()->getActionName();

for main page you can put condition where controller is "index" and action is "index" you code should execute or not to execute thats alll..............

If you are not in controller user

Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
Zend_Controller_Front::getInstance()->getRequest()->getActionName();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM