51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
|
<?php
|
||
|
$show_sep=true;
|
||
|
$db = new PDO('sqlite:projects_data/projects.db') or die('database error');
|
||
|
include('header.tpl');
|
||
|
?>
|
||
|
<div id="content_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 from collection_items where collection_id = :id';
|
||
|
$ci_query = $db->prepare($query);
|
||
|
$ci_query->bindParam(':id', $_REQUEST['id']);
|
||
|
$ci_query->execute();
|
||
|
?>
|
||
|
|
||
|
<h1>
|
||
|
<? 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'>
|
||
|
<img src='{$ci_img_url}' alt='Cover picture of {$ci['name']}' />
|
||
|
<h1>{$ci['name']}</h1>
|
||
|
</div>
|
||
|
");
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
|
||
|
<?
|
||
|
include('footer.tpl');
|
||
|
$db = null;
|
||
|
?>
|