Ejemplo n.º 1
0
$row = $product->readOne();
// set page title
$page_title = $product->name;
// include page header HTML
include_once 'layout_head.php';
?>
<!-- HTML form for viewing a product -->
	<table class='table table-hover table-responsive table-bordered margin-1em-zero'>
		 
		<tr>
			<td colspan='2'>
			<?php 
// set product id
$product_image->product_id = $id;
// read all related product image
$stmt_product_image = $product_image->readAll();
// count all relatd product image
$num_product_image = $stmt_product_image->rowCount();
// if count is more than zero
if ($num_product_image > 0) {
    $x = 1;
    // loop through all product images
    while ($row = $stmt_product_image->fetch(PDO::FETCH_ASSOC)) {
        // image name and source url
        $product_image_name = $row['name'];
        $source = "{$home_url}uploads/images/{$product_image_name}";
        // create thumbnail for image
        echo "<a href='{$source}' data-gallery>";
        echo "<div class='photo-thumb' style='background: url({$source}) 50% 50% no-repeat;'>";
        echo "</div>";
        echo "</a>";