<?php
class createConnection //create a class for make connection
{
var $host="localhost";
var $username="username"; // specify the sever details for mysql
Var $password="password";
var $database="database name";
var $myconn;
function connectToDatabase() // create a function for connect database
{
$conn= mysql_connect($this->host,$this->username,$this->password);
if(!$conn)// testing the connection
{
die ("Cannot connect to the database");
}
else
{
$this->myconn = $conn;
echo "Connection established";
}
return $this->myconn;
}
<?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...
Comments
Post a Comment