A simple static
website for an art gallery
using completely client-side
dynamically generated HTML
.
The repository depicts an example of how a simple static website (in this case
an Art Gallery
), could be made to dynamically generate HTML
on the
client's browser
using Javascript
and JSON
.
This section covers the attributes necessary to the working of the website
located in the server/data/catalog.js
file:
$ cat server/data/catalog.js
catalog = {
"A View of Mount Fuji Across Lake Suwa (Lake Suwa in Shinano Province)": {
"fname": "Lake_Suwa_in_the_Shinano_province.jpg",
"fpath": "/images",
"gal_width": "320",
"gal_height": "213",
"itm_width": "1024",
"itm_height": "681",
"price": "$1000",
"cart": false,
"medium": "canvas",
"size": "40x26",
"units": "in",
"id": "#012"
},
.
.
.
}
Above we can see all the attributes
necessary for each item to work with the
Javascript
source code (located in server/scripts
). The structure of the
catalog.js
file is simply a dictionary of dictionaires.
You will notice the name of the item (e.g. A View of Mount Fuji Across Lake Suwa (Lake Suwa in Shinano Province)
) is the dictionary key
, and the value
is itself a dictionary of attributes
.
These attributes
are all used in generating the HTML dynamically
in the
client's browser
. Below we will discuss each attribute:
fname
: The actual filename on thehardrive
for the imagefpath
: Thedirectory path
where the file is locatedgal_width
: The width of the image displayed in thegallery.html
pagegal_height
: The height of the image displayed in thegallery.html
pageitm_width
: The width of the image displayed in theitem.html
pageitm_height
: The height of the image displayed in theitem.html
pageprice
: The price of the itemcart
: Atrue/false
value to allowcart checkout
for itemmedium
: e.g.canvas
,giclee print
, etc ...size
: Size of the pieceunits
: Units used bysize
attributeid
: Unique numericalitem
identification number