Site structure help request

  • Thread starter Thread starter Carl Gilbert
  • Start date Start date
C

Carl Gilbert

Hi

I am looking to develop a site using ASP.NET. I have a couple years
experience with VB.NET and some experience with ASP.NET .

I have one page that details a number of categories
(http://www.gallerox.com/demopage1.jpg) that links off to another page that
will display some of the images within this category
(http://www.gallerox.com/demopage2.jpg). At the bottom of this page I will
have links to allow the user to view other images within the same category.

I need to find a way to link off the second page and dynamically show a set
of images based on the selected category and sub page number.

So really I would have about 8 categories with about 40 or 50 images in each
category. I then want to have 1 page to display the categories and then one
page to display any 8 images from the specified category. The first page
would have to tell the second page which category was selected and would
obviously start at the beginning of the collection and by using the numbered
buttons at the bottom of the page, the same page should be loaded with the
next eight images from the same category.

When an image from the second page is clicked, a third page would display
the image in a larger format. Therefore the site needs to remember which
image was clicked so when I go to a forth or fifth page, the site remembers
the image selection.

I have not implemented a file naming system yet as I suspect this would have
a bearing on how the images are referenced.

I don't mind using a SQL back end to store the images but this might just
complicate matters.

Any thoughts on how to best implement this would be greatly appreciated.

Regards, Carl Gilbert
 
Sounds like a great project to cut your teeth on .NET and SQL server.
Here's how I'd approach it. You'll have two tables in your database,
one for categories and one for images, as such:

Category
------------
CategoryID
CategoryName (or CategoryImageUrl, if you want to keep those images as
links)

Image
-----
ImageID
CategoryID
ImageTitle
ImageUrl


You could probably get away with just three pages: one to display a
list of categories, one to show images for a given category, and one to
show full sized gallery images. They'll link to one another as
follows:

CategoryList.aspx
will have a bunch of links that look like...

ImageList.aspx?categoryID=4
, which will have a bunch of image links that look like...

ImageDisplay.aspx?imageID=25


Hopefully, that should get you pointed in the right direction. Keep us
posted on how it turns out!


Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 
Thanks for your reply Jason. The idea sounds like a good one.

The category links will be images so I think a table with the URL for the
image would be better.

Would I be right in thinking that I would use something like session
variables to track the selections?

I don't think I would need image title as the images will only have an ID
and URL.
Assuming that the ImageID would have to be unique, would it be a good idea
to prepended the CategoryID on to the ImageID?
This way I could keep all the images running form 1-onwards regardless of
the group.

There would be two tasks I would need to perform:

1. Determine how many images are in a given category. This could be done by
just counting the number of records with the specified CategoryID.
2. The images would need to be ordered and I would need to return 8 at a
time. If I know the images are going to run from 1-onwards, then I can use
the page number to determine which set of eight images. This does mean I
have to prepended the CategoryID onto some sort of Integer I might use to
iterate through the images and does butcher what should be a simple
identifier.

I'm sure I'm over complicating things as usual but I would appreciate it if
you could consider the above constraint.

Regards, Carl
 
Carl said:
Would I be right in thinking that I would use something like session
variables to track the selections?

It's best to think of session variables as something to use as a last
resort. They'll always lead to ugly code that's impossible to debug.
Most sites that I put together only have a single session variable
holding the UserID for the client.
Assuming that the ImageID would have to be unique, would it be a good idea
to prepended the CategoryID on to the ImageID?

Ah, but if you have the ImageID, you can quickly look up the CategoryID
that it's associated with. It's always best to pass the least possible
information the querystring that will allow you to render a page.

If I know the images are going to run from 1-onwards, then I can use
the page number to determine which set of eight images...

If you're using DataGrids, they can handle paging for you. Otherwise,
you'll have to roll your own. It's not too hard, and you can do it
either in the query or in the codebehind. Your urls would look
something like

ImageList.aspx?categoryID=4&offset=16

or

ImageList.aspx?categoryID=4&pageIndex=2
I'm sure I'm over complicating things as usual but I would appreciate it if
you could consider the above constraint.

Sounds like you're on the right track. Good luck!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 
So if I wanted to make sure the images were returned in the same order
everytime, would I have to simply enter the image ID in the order I wanted
them returned and then just sort by image ID on the query?

So if I had three categories with six images in each, would I go something
like:

Categories:
======================
categoryID: 1
categoryID: 2
categoryID: 3

Images
======================
imageID: 1, categoryID: 1
imageID: 2, categoryID: 1
imageID: 3, categoryID: 1
imageID: 4, categoryID: 1
imageID: 5, categoryID: 1
imageID: 6, categoryID: 1
imageID: 7, categoryID: 2
imageID: 8, categoryID: 2
imageID: 9, categoryID: 2
imageID: 10, categoryID: 2
imageID: 11, categoryID: 2
imageID: 12, categoryID: 2
imageID: 13, categoryID: 3
imageID: 14, categoryID: 3
imageID: 15, categoryID: 3
imageID: 16, categoryID: 3
imageID: 17, categoryID: 3
imageID: 18, categoryID: 3



Regards, Carl
 
Correct on all counts. If you want to sort your images on something
other than ID or URL, you can simplay add a SortOrder column to that
table and sort on it instead:

Images
======================
imageID: 1, categoryID: 1 , sortOrder: 40
imageID: 2, categoryID: 1 , sortOrder: 20
imageID: 3, categoryID: 1 , sortOrder: 30
imageID: 4, categoryID: 1 , sortOrder: 10


Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top