<?php $obj = new Mage_Catalog_Block_Navigation(); $store_cats = $obj->getStoreCategories(); $current_cat = $obj->getCurrentCategory(); $current_cat = (is_object($current_cat) ? $current_cat->getName() : ''); foreach ($store_cats as $cat) { if ($cat->getName() == $current_cat) { echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>\n<ul>\n"; foreach ($obj->getCurrentChildCategories() as $subcat) { echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>\n"; } echo "</ul>\n</li>\n"; } else { echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>\n"; } } ?>
To get Domain name from the url, we can use parse_url() php function. This would filter the domain name from the given url. $domain = str_ireplace ( 'www.' , '' , parse_url ( $url , PHP_URL_HOST )); This would return the google.com for both http://google.com and http://www.google.com
Comments
Post a Comment