Creating a gallery with Excel Data
Most templates included with magic
gallery software are great for small sites. But what if you have a
larger more complicated site? What if you have price, descriptions and
other data about your photos? Luckily we've thought of that.
This tutorial describes how to create a magic gallery template that can
enable more complicated websites such as e-commerce, online ordering,
photo printing, large online galleries and more.
This tutorial assumes that you know the
following:
- Basic knowledge of HTML
- Familiarity with Excel
The basics of templates
A template contains the basics
for the look and feel of your website. The templates that are
included with Magic Gallery are located in the following folders:
C:\program files\magic gallery\templates\
C:\program files\magic gallery\templates\magicgallery\
Open the second folder and take a look at
the HTML for the file "BasicBlacksingle.htm" you will
see that most of the HTML is standard but there are certain special
tags. These special tags begin and end with <%
%>. In this tutorial we will be discussing the tags GETDATA and
GETTEXT.
Get text and Get data
To create a compelling gallery you need to master two essential tags:
GETDATA and GETTEXT. These two tags allow you to dynamically get
information either directly from the user or from an excel spreadsheet.
- GetData - gets information from an
excel spreadsheet
- GetText - prompts the user for
text information.
As the template is being parsed every
time it sees a GetText it will prompt the user for text and every time
it sees GetData it will try to get the data from excel. To create a
large gallery you want to make population of the data as automatic as
possible by replacing GetText tags with GetData.
To begin, find the place in the basic blacksingle.htm template where it
says:
<%GETTEXT count=-1 prompt="Enter a photo description" %>
Now replace this line with the following
lines:
Description: <%GETDATA count=-1
column="Description" %> <br>
Price: <%GETDATA count=-1 column="Price"
format="Currency" %><br>
Size: <%GETDATA count=-1 column="Artist" %><br>
These three lines tell the program to get
data for this particular image that matches the colums Description,
Price and Size. The currency format also tells the program to format the
price column with the appropriate dollar signs and comas. You can
use any column data that you want just make sure the column has a unique
name.
The template is now setup to get data
from Excel but we still have to create the actual data.
Creating the data
The software is very flexible in
how it gets data from excel. There are only three basic rules.
- You need a column with the photo
filename
- You can't have the filename more then
once in the spreadsheet
Here is an example spreadsheet:
| File Name |
Artist |
Description |
Price |
| sun-sky.jpg |
Greg Raiz |
Picture of the sky |
300 |
| flower.jpg |
Dan Levin |
A nice flower |
230 |
| DesktopShot.jpg |
Joe Budman |
Look ma' it's my desk |
5000 |
| AnotherSky.jpg |
Zsolt Mark |
Fluffy little clouds |
320 |
Create a similar file and save it on your
computer. Remember to use the correct filenames in the filename column.
Also make sure to use the same column headers as those in the getdata
tags. The columns match up with the columns and filenames match up wth
the images that you select in your gallery. For the file name do not
include the full path, just use the filename as shown.
Create the gallery
You are now ready to create your
gallery. Save and close your excel file and open magic gallery. Select
your photos as usual, remember to use the same photos that you placed in
your excel spreadsheet. Select the basic black template, or if you
modified a different template use that instead.
As
the software creates your gallery it will ask for the excel file with
your data. Simply browse to this file and select it. Magic Gallery will
now use excel to process your gallery. Do not close excel or Magic
Gallery will not be able to get to your data.
Conclusion
Creating
more complex galleries is fairly easy with Magic Gallery. You can use
the software to create large online exhibitions and you can easily edit
the data. For more information on using Magic Gallery templates
please see our template developers kit pages.
Using the techniques in this template coupled you can create really
complex galleries. You can even link to dataprocessing and ecommerce
functions by including links in your templates such as:
<a
href="/order.asp?file=/<%PICTURENAME date=true %>"
>
Place Online Order
</a>
This will pass the
picturename information to your order processing script. You can see
this in action at www.fluryco.com, www.equatorgallery.com
and soon at www.franklinbowlesgallery.com
Creating
a customized web site with extra information does not require that much
work and the pay off is a great looking website.
Enjoy
your photos.
- Gregory Raiz
Lead
Developer for Magic Gallery