To check for any other cms page just replace ‘home’ in
the if condition to the identifier of the page you want to check.
< ?php
$route = Mage::app()->getRequest()->getRouteName();
$id = Mage::getSingleton('cms/page')->getIdentifier();
if($route == 'cms' && $id == 'home') {
echo 'Homepage!';
}
?>
The code shown below checks for cart page. Change the if condition for any other page.
< ?php
$request = $this->getRequest();
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if($module == 'checkout' && $controller == 'cart' && $action == 'index'):
echo "Cart page"
endif;
?>
the if condition to the identifier of the page you want to check.
< ?php
$route = Mage::app()->getRequest()->getRouteName();
$id = Mage::getSingleton('cms/page')->getIdentifier();
if($route == 'cms' && $id == 'home') {
echo 'Homepage!';
}
?>
The code shown below checks for cart page. Change the if condition for any other page.
< ?php
$request = $this->getRequest();
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if($module == 'checkout' && $controller == 'cart' && $action == 'index'):
echo "Cart page"
endif;
?>
No comments:
Post a Comment