From 5ffde76d5e956dccd40e624c14863291380fefd3 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 10 Nov 2020 23:25:09 +0100 Subject: [PATCH] use sqlite for collection information storage this should be easier to extend than the multi dimensional php array used before --- collections.php | 46 ++++++++++++++-------------------- projects_data/projects.db | Bin 0 -> 49152 bytes show_collection.php | 51 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 projects_data/projects.db create mode 100644 show_collection.php diff --git a/collections.php b/collections.php index c90618e..10664c9 100644 --- a/collections.php +++ b/collections.php @@ -1,42 +1,32 @@
-
-
-
- example image for ' . $c['name'] .' - - -
-
- ' . $c['collection_description'] . ' + +foreach($db->query('select id, name, cover_image from collections;') as $c) { + $collection_id = $c['id']; + $cover_image = $c['cover_image']; + $collection_name = $c['name']; + + print(" +
+
+
-

' . $c["name"] . '

+

{$collection_name}

- '; - } - print($html); - $index += 1; + "); +} + ?>
-
\ No newline at end of file diff --git a/projects_data/projects.db b/projects_data/projects.db new file mode 100644 index 0000000000000000000000000000000000000000..41276f1285cd7c8aa2f2a63bea2f87abf7e4ecd3 GIT binary patch literal 49152 zcmeI5&u<&Y6~~ueiLw;QEb6#wqXL=8Xk$aP1j!K)Bflysj3d~VqF-oT1R;jILvpPB zm6@ew8b|>W_RpAm7&ph#vV-kVf@qaKTZtO-!Y~65EEbmOn?b60VeQ& zLjacpUro+o`{m@^Tv)|R$wVtZ-%dQD6RX%wj- z*J)y>#f7oaX&p|FuC8s@uGTii+WNLw+qr&S?5wSB?9{3_oXA*Bk8am~gCmEJhROy; zXH;F0iHZd2ZDr~@mMxS#ST!=dwYhp@Y4fJIR=atDnioqu+v}@qkn=`uZTsTb#rwZK zH!^wYQt5-1Q>rg=9T#1(J-9!1l!it2Le0TKkIf~s6#ySr?4sDLy;0k&t*z9y9yYc^4Y=d;ul=Mvxpk@J z=_FKl;4gq$mz_Ly`}M*4h<1JcV9HbXXU~pIUb#|wfA3NDDJ*}`O1;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2`~XBzyz286JP>NfC(^x6HI{C`5(XjfB*UaCs+vNfC(@GCcp%k zzzHTWQITGGqU%j`E7_UP&(tUWHSzZoEG~=21egF5U;<2l2`~XBzyz286Zqi~xK%n` z^5#8nqvgM@jmqPW6-%b2l3aD{R<2A$zfEs-bX%FKi154j_<8q6)KMZ&GkN!jABPWn zRn_HwRkOFU*4Z-JdX5;4Y%7(wg+blHFcN>UH#P4K*KE)UQ?b&PCZ^}qhXQR$VN@3B zK#H`99oyE~o>9TBu$fG>Z3|VD3R0acR2T0o1o2i+S}U`xt&LIky`j;PH?w;0sVQ&B zJ+(fUkrHhsO}-Q5M#d7NDDg`nBRnQQq|X-?=H@S7+^=f>#cQIKMqzazM@yPSO^!hfESnJxH!64G;mnVg%=8e_ay=Jinq8i^@``eWo3SE z;uNsc{;u0^cMVjK;;NB>j`S0V^kUKSvPqM>sw&_fp>7#%MMj#-BOD_`+r75xtzKK? z8ua}?um1-GelYNfC(@GCcp%k02BDZ5}@_}DHnBw;v%G3U8X*IDKe&>c}f6(zz z$xxsQi+Kpj=EG +
+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(); +?> + +

+ +

+
+ +
+
+ +
+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(" +
+ Cover picture of {$ci[ +

{$ci['name']}

+
+ "); +} +?> +
+ + \ No newline at end of file