Log in

View Full Version : Need Some Help



mydeas
01-21-2009, 08:19 PM
I am not sure if I am wanting a directory type of script or a pagination type of script. Maybe you can tell me and help me?

I am currently working on my website and I am using only HTML (SSI since it will be quite large). I have certain images that link to another page that shows products. I messed up, and all of the new images are put at the back pages. Which is no good. I need these certain images to show up in certain categories (separate pages) depending on the image. When I am done there should be somewhere around 7000 images. That is the best explanation I can give without you seeing what I am talking about. My website is http://www.mydeasonline.com. Just imagine there would be thousands of images set up on each category page. So, I obviously need several pages for each category. If you look at the bugs section I added two new ones which are on the last page. <<Rolling Eyes>>

If someone could help, I would greatly appreciate it. I am looking for a free script or even someone to walk me through this. Not sure how to set up a database for this sort of thing. Tried and was lost.

Thank you so much.

djr33
01-23-2009, 02:05 AM
A database is a collection of information organized in tables, then in entries, and finally by cell (column).
To query a database, you send the information to it either to find, save or change information.
The structure that matters is how you will deal with this process in your website. Where will you put your code, how will you identify each picture, etc. You can create a database in this case based on filename for the image then containing attributes, like "categories" which would contain a list of its related categories.
Then just search for each that has in its categories the particular category you want. Other similar strategies may work too.

First thing to do is decide what language you will use for both the script and the database-- common is PHP with MySQL, but other options, like ASP with Access exist too. Check what your host has and start there.

You will need to write a script that does the logic and include within it both login information for the database and queries that will find the correct information, as well as probably create an admin page that will allow you to add/modify images. First, though, you will need to create the database itself, defining the tables and the cells in each.

I recommend starting with an introductory tutorial here:
http://php-mysql-tutorial.com

If you need more specific help, then we need to know what languages you will be using, and how you want to organize the data. It is best to keep the images as files, not embedded within the database (that would make it slower).

As a hint to start, you should make a test project to try interacting with the database; databases are not particularly difficult, but they do take a little time to get used to, but once you do it will be very helpful.

mydeas
01-23-2009, 10:20 AM
This is what I have so far. I can not get the images to go into a grid. I need 4across. Then I need to set up pagination so that there are 16-20 images on each page. Any help...pleeeeaaase??

<?php
// tiny, small, medium, large, huge.
switch( $gridCellSize ) {
case 'tiny':
$gridCellSize = 50;
break;
case 'small':
$gridCellSize = 92;
break;
case 'medium':
$gridCellSize = 195;
break;
case 'large':
$gridCellSize = 210;
break;
case 'huge':
$gridCellSize = 300;
break;
default:
$gridCellSize = $gridCellSize;
}

$gridCellWidth = $gridCellSize + 6;
$gridCellHeight = $gridCellSize + 4;

// Retrieve all the data from the "example" table
$query = "SELECT * FROM designs WHERE main_category='Bugs' ORDER BY design_id";
$result = mysql_query($query)
or die(mysql_error());

// store the record of the "example" table into $row
while($row = mysql_fetch_array($result)){

// output the product's grid cell
echo "<div class='gridCell' style='width: {$gridCellWidth}px;margin:0 {$gridCellSpacing}px {$gridCellSpacing}px 0;'></div>";

echo $row['content'];

echo "<div class=\"clearMe\"></div><br /><div class='count' style='width:".$gridWidth."px'>\n\n";
}
?>

djr33
01-23-2009, 10:33 AM
Replace the last part with this--

// store the record of the "example" table into $row
for($x=0;$row = mysql_fetch_array($result);$x++){

if ($x==3) {
echo '<tr>';
}


// output the product's grid cell
echo "<div class='gridCell' style='width: {$gridCellWidth}px;margin:0 {$gridCellSpacing}px {$gridCellSpacing}px 0;'></div>";

echo $row['content'];

echo "<div class=\"clearMe\"></div><br /><div class='count' style='width:".$gridWidth."px'>\n\n";

if ($x==3) {
$x=0;
echo '</tr>';
}
}
}

Alternatively, remove the first if($x..... and that will allow just text after the row.
I used <tr> and </tr> for placeholders for whatever you want to use to split the rows.

mydeas
01-23-2009, 11:01 PM
That didn't work. :(

But....I tried something else. Now, I have pagination, a grid of 4 across and however many down, and I have it sorting by date! Yipee!

Now, I just have to put everything into the datebase. That should be fun. And get it to work on the site.

Thanks so much for your help!