I want to create the following conditional statement based on the cms page url to show a different background image for my magento store. Syntax seems good, but it doesn't show up.
<?php
if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'):
$Page = Mage::getSingleton('cms/page')->getTitle();
endif;
if($Page == 'about-us'):
//echo $this->getChildHtml('bg_aboutus');
echo '<div class="bg"><img src="' . $this->getSkinUrl("images/about_us.jpg") . '" alt="office interiors" ></div>';
endif;
?>
Please use this to add condition in your page
<?php if (strpos(Mage::helper('core/url')->getCurrentUrl(),'about-us') != false ) :
echo '<div class="bg"><img src="' . $this->getSkinUrl("images/about_us.jpg") . '" alt="office interiors" ></div>';
endif;
endif;?>
Here are the ways you can router or method action information anywhere in Magento :
Mage::app()->getRequest()->getControllerName(); // return controller name
Mage::app()->getRequest()->getActionName(); // return action name
Mage::app()->getRequest()->getRouteName(); // return routes name
Mage::app()->getRequest()->getModuleName(); // return module name
to get module, controller, action name
Mage::app()->getFrontController()->getAction()->getFullActionName();