59 lines
No EOL
1.5 KiB
PHP
59 lines
No EOL
1.5 KiB
PHP
<?php
|
|
$show_sep=true;
|
|
$db = new PDO('sqlite:projects_data/projects.db') or die('database error');
|
|
include('header.tpl');
|
|
?>
|
|
<div id="collection_padding">
|
|
<?php
|
|
// get collection parameters
|
|
$query = 'select id, name, description, cover_image from collections where id = :id';
|
|
$col_query = $db->prepare($query);
|
|
$col_query->bindParam(':id', $_REQUEST['id']);
|
|
$col_query->execute();
|
|
|
|
$collection_info = $col_query->fetch();
|
|
|
|
// get collection items
|
|
$query = 'select name, material, description, cover_image, id from collection_items where collection_id = :id';
|
|
$ci_query = $db->prepare($query);
|
|
$ci_query->bindParam(':id', $_REQUEST['id']);
|
|
$ci_query->execute();
|
|
?>
|
|
|
|
<h1 class="collection_name">
|
|
<? print($collection_info['name']); ?>
|
|
</h1>
|
|
<section class="description">
|
|
<? print($collection_info['description']); ?>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="ci_container">
|
|
<?php
|
|
foreach($ci_query->fetchAll() as $ci) {
|
|
if ($ci['cover_image'] == null) {
|
|
$ci['cover_image'] = $collection_info['cover_image'];
|
|
}
|
|
$ci_img_url = 'projects_data/img/' . $ci['cover_image'];
|
|
print("
|
|
<div class='collection_item'>
|
|
<a href='show_ci.php?id={$ci['id']}'>
|
|
<img src='{$ci_img_url}' alt='Cover picture of {$ci['name']}' />
|
|
</a>
|
|
<h1>{$ci['name']}</h1>
|
|
<p class='ci_material'>
|
|
{$ci['material']}
|
|
</p>
|
|
<p>
|
|
{$ci['description']}
|
|
</p>
|
|
</div>
|
|
");
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<?
|
|
include('footer.tpl');
|
|
$db = null;
|
|
?>
|