Example #1
0
//session handeling and processing section
session_start();
$_SESSION['id'] = rand(1000, 10000);
include_once "libraries/items_class.php";
include_once "libraries/DataBase/result_processor_class.php";
$items = new Item();
$result = $items->get_result_root_categories();
$rp = new Result_processor();
$arr = array("id", "name");
$categories = $rp->get_array_of($result, $arr);
$body = "";
//print_r($categories);
foreach ($categories as $category) {
    //echo " The product is <br/>".$category['name']."";
    $products = $items->get_array_products($category['id']);
    //print_r($products);
    $body .= "<div class=\"category\">" . $category['name'] . "<ul>";
    foreach ($products as $product) {
        $body .= "<li><a href=\"details.php?id=" . $product['id'] . "\">" . $product['name'] . "</a></li>";
    }
    $body .= "</ul></div>";
    //category
}
//echo $body;
//die();
//Required variables initialization section
/*
 * variables to be defined are-:
 *	$image_path, points to the location of the header image "./public/images/header1.jpg"
 *	$navigation_menu, <ul><li><a href="#">menu1</a></li></ul>,