PHP & Magento If statement based on page url
magento, php
Solution
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;?>
Problem
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; ?> ```