PHP Classes

File: fwphp/01mater/shop/ch24_guitar_shop/home_view.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/shop/ch24_guitar_shop/home_view.php  >  Download  
File: fwphp/01mater/shop/ch24_guitar_shop/home_view.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: 2,672 bytes


Class file image Download
<?php include 'view/header.php'; ?>
include 'view/sidebar.php'; ?>
<main class="nofloat">
    <h1>Featured products</h1>

      B12phpfw coding is much better compared to "classic" MVC coding presented here (Murach 2014. year) which seems to me spaghetti code because :
         <b>Minuses</b>: Coding in shop folder (PAGES NAVIGATION) in index.php using $pp1, Autoload, Config_allsites and Home_ctr is according B12phpfw coding standards - it is clear why.
         <br>And it is clear why other coding standards (DBI) should be from B12phpfw (ee from Oracle Forms). B12phpfw coding has about dozen coding standards including above mentioned which make big difference, ee make B12phpfw much better compared to "classic" MVC coding.
         <b>Pluses</b>: coding presented here is not to simple, uses PDO and is result of lot of work with good some basic ideas and codings.


    <p>We have a great selection of musical instruments including
        guitars, basses, and drums. And we're constantly adding more to give
        you the best selection possible!
    <?php foreach ($products as $product) :
// Get product data
$list_price = $product['listPrice'];
$discount_percent = $product['discountPercent'];
$description = $product['description'];
// Calculate unit price
$discount_amount = round($list_price * ($discount_percent / 100.0), 2);
$unit_price = $list_price - $discount_amount;

// Get first paragraph of description
$description_with_tags = add_tags($description);
$i = strpos($description_with_tags, "</p>");
$first_paragraph = substr($description_with_tags, 3, $i-3);
            <td class="product_image_column" >
                <img src="images/<?php echo htmlspecialchars($product['productCode']); ?>_s.png"
                    <a href="catalog?product_id=<?php echo
$product['productID']; ?>">
                        <?php echo htmlspecialchars($product['productName']); ?>
                    <b>Your price:</b>
                    $<?php echo number_format($unit_price, 2); ?>
                    <?php echo $first_paragraph; ?>
    <?php endforeach; ?>
<?php include 'view/footer.php'; ?>

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