PHP Classes

File: fwphp/01mater/shop/ch24_guitar_shop/view/sidebar.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/shop/ch24_guitar_shop/view/sidebar.php  >  Download  
File: fwphp/01mater/shop/ch24_guitar_shop/view/sidebar.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 1,717 bytes
 

Contents

Class file image Download
<aside>
    <h2>Links</h2>
    <ul>
        <li>
            <a href="<?php echo $app_path . 'cart'; ?>">View Cart</a>
        </li>
            <?php
           
// Check if user is logged in and
            // display appropriate account links
           
$account_url = $app_path . 'account';
           
$logout_url = $account_url . '?action=logout';
            if (isset(
$_SESSION['user'])) :
           
?>
<li><a href="<?php echo $account_url; ?>">My Account</a></li>
                <li><a href="<?php echo $logout_url; ?>">Logout</a>
            <?php else: ?>
<li><a href="<?php echo $account_url; ?>">Login/Register</a></li>
            <?php endif; ?>
<li>
            <a href="<?php echo $app_path; ?>">Home</a>
        </li>
    </ul>
       
    <h2>Categories</h2>
    <ul>
        <!-- display links for all categories -->
        <?php
           
require_once('model/database.php');
            require_once(
'model/category_db.php');
           
           
$categories = get_categories();
            foreach(
$categories as $category) :
               
$name = $category['categoryName'];
               
$id = $category['categoryID'];
               
$url = $app_path . 'catalog?category_id=' . $id;
       
?>
<li>
            <a href="<?php echo $url; ?>">
               <?php echo htmlspecialchars($name); ?>
</a>
        </li>
        <?php endforeach; ?>
</ul>
   
    <h2>Temp Link</h2>
    <ul>
        <li>
            <!-- This link is for testing only.
                 Remove it from a production application. -->
            <a href="<?php echo $app_path; ?>admin">Admin</a>
        </li>
    </ul>
</aside>

For more information send a message to info at phpclasses dot org.