SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
May 6, 2006, 16:55 #1
- Join Date
- Jan 2006
- Posts
- 221
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Cols and rows plz help, I am so stuck.
I am working on a script and having some major issues with some of the code. I have been stuck at this one point for 4 days now and I have been working on and trying to figure out how to code this one page for 10-12 hours a day for the last 4 days. I have had no luck and was hoping someone can help me figure this one out.
The site name is Florida Fine Cars.
How the site works. It is a listing website site for the all the sales people at the car dealership I work for. Each sales person can sign in and upload photos of thier monthy cars. Each sales person can choose a sub category, under the main category(main category is view all cars, sub cats are all the car manufactuers...such as honda ...acura.) No matter who the sales person is or what sub cat they list thier car in the pictures are stored in one folder(one images folder for all pics and cat and subcats). Also no matter what sub category the sales people list the car it it will also show up in view all cars (the main category). Also the sales people can upload 10 pictures of each car.
The problem which I need help with is when you click on either of them the main category(view all cars) or the subcategories(acura...honda...ford...chevy) the actual script for when you click on them is search.php that is where I am having the problem. The search results displays the first thumbnail image and a short description on the right, then the next listing in that sub category is listed under it, when you click on the tumbnail it then goes in the actual listing with the full description and other 9 images. I am trying for the last 4 days over 10 hours a day to change the script so that instead of the results for the cat and subcat's being displayed as they now are one under the other with script on the side of the image...to be displayed in cols and rows... with no script on the right of the pic. just the main image (thumbnail) of the car with the year & model(such as 05 accord) under the image.
I have included a screenshot of the site with the search results when you click on a sub cat, and the script below. I will appreciate any help anyone can give me so I can accomplish this. Thank you everyone.,
Click here for picture of the current search results...
Click here to see a picture of what I am trying to achieve.
This is the searchtemplate.php
PHP Code:<?=$ListingTable?>
PHP Code:require_once("conn.php");
require_once("includes.php");
$query = array();
if(!empty($_GET[c]))
{
$query[] = "re2_listings.CategoryID = '$_GET[c]' ";
}
if(!empty($_GET[s]))
{
$query[] = "re2_listings.SubcategoryID = '$_GET[s]' ";
}
if(!empty($_GET[search_state]))
{
$query[] = "re2_listings.state = '$_GET[search_state]' ";
}
if(!empty($_GET[search_city]))
{
$query[] = "re2_listings.city = '$_GET[search_city]' ";
}
if(!empty($query))
{
$MyQuery = implode(" and ", $query);
$MyQuery = "and ".$MyQuery;
}
////////////////////////////////////////////////////////////
////////// order by
$order = array();
if(!empty($_GET[orderby]))
{
$MyOrder = explode("|", $_GET[orderby]);
while(list(,$ov) = each($MyOrder))
{
if($ov == "DateAdded")
{
$order[] = " re2_listings.DateAdded desc ";
}
if($ov == "Price")
{
$order[] = " re2_listings.Price asc ";
}
if($ov == "address")
{
$order[] = " re2_listings.address asc ";
}
}
}
else
{
if(!empty($_GET[p]))
{
$order[] = " re2_listings.Price asc ";
}
if(!empty($_GET[r]))
{
$order[] = " re2_listings.rooms asc, re2_listings.bathrooms asc, re2_listings.garage asc ";
}
if(!empty($_GET[city]))
{
$order[] = " re2_listings.city, re2_listings.address, re2_listings.state ";
}
}
if(count($order) > '0')
{
$MyOrder = implode(", ", $order);
}
if(empty($MyOrder))
{
$MyOrder = " order by re2_agents.PriorityLevel desc, re2_listings.DateAdded desc";
}
else
{
$MyOrder = " order by re2_agents.PriorityLevel desc, $MyOrder";
}
if(!empty($_GET[Start]))
{
$Start = $_GET[Start];
}
else
{
$Start = '0';
}
$ByPage = '20';
$q1 = "select * from re2_listings, re2_agents, re2_priority where re2_listings.AgentID = re2_agents.AgentID and re2_agents.PriorityLevel = re2_priority.PriorityLevel and re2_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage ";
$qnav = "select * from re2_listings, re2_agents where re2_listings.AgentID = re2_agents.AgentID $MyQuery";
$r1 = mysql_query($q1) or die(mysql_error());
$lrows = mysql_num_rows($r1);
if($lrows > '0')
{
$ListingTable .= "<table align=center width=510 border=1 bordercolor=black frame=hsides rules=rows cellspacing=0>\n";
while($a1 = mysql_fetch_array($r1))
{
$ListingTable .= "<tr onMouseOver=\"this.style.background='#E2E2E2'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='white'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
if($a1[PriorityLevel] > '1')
{
$sub = "<span class=RedLink><sup>$a1[PriorityName]</sup></span>";
}
$ListingTable .= "\n\t<td width=15>";
if(!empty($a1[image]))
{
$im_array = explode("|", $a1[image]);
$ListingTable .= "<img src=\"re_images/$im_array[0]\" width=125 height=93>";
}
$ListingTable .= "</td>\n\t";
$ListingTable .= "<td width=250>$a1[city] $a1[state] $a1[address] $sub</td>\n\t";
$ListingTable .= "<td width=250>$a1[rooms] miles $a1[country] Transmission";
$MyPrice = number_format($a1[Price], 2, ".", ",");
$ListingTable .= "</td>\n\t<td align=center width=100><b>$$MyPrice</td>\n";
$ListingTable .= "</tr>\n";
}
$ListingTable .= "</table>";
$rnav = mysql_query($qnav) or die(mysql_error());
$rows = mysql_num_rows($rnav);
if($rows > $ByPage)
{
$ListingTable .= "<br><table align=center width=510>";
$ListingTable .= "<td align=center><font face=verdana size=2> | ";
$pages = ceil($rows/$ByPage);
for($i = 0; $i <= ($pages); $i++)
{
$PageStart = $ByPage*$i;
$i2 = $i + 1;
if($PageStart == $Start)
{
$links[] = " <span class=RedLink>$i2</span>\n\t ";
}
elseif($PageStart < $rows)
{
$links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";
}
}
$links2 = implode(" | ", $links);
$ListingTable .= $links2;
$ListingTable .= "| </td>";
$ListingTable .= "</table><br>\n";
}
}
else
{
$ListingTable = "<br><br><center>No results were found!</center>";
}
require_once("templates/HeaderTemplate.php");
require_once("templates/SearchTemplate.php");
require_once("templates/FooterTemplate.php");
-
May 6, 2006, 18:17 #2
- Join Date
- Jan 2006
- Posts
- 221
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Please if anyone knows how I can script this so I can get rows and columns of pics please give me some direction as to how I can do this. I am totally lost.
-
May 6, 2006, 18:30 #3
- Join Date
- Jan 2006
- Posts
- 221
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If anyone is up for $100.00 it is now this is now listed in the Contest Forum..
-
May 6, 2006, 18:34 #4
- Join Date
- Aug 2005
- Posts
- 102
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am afraid I dont really get it. Are the cols suppose to have identical pictures? I assume it is a mock up. If the pics are diffrent, is each col and each frame a different car?
-
May 6, 2006, 18:37 #5
- Join Date
- Jan 2006
- Posts
- 221
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mkdrums
-
May 6, 2006, 19:07 #6
- Join Date
- Aug 2005
- Posts
- 106
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hmm...just did something like this on an ecommerce site I'm building.
I tried a table for this at first, but since the site has a liquid layout and I wanted the number of columns to increase with the browser width, I went with a definition list. This has worked much better.
Hope that helps some...I'm not on my regular system at the moment, but I'll post the code when I get back.
Added: OK, this is pretty close to what I have in the app, but I can't remember exactly how I styled the dt / dd combination, so this uses a single dd with a span to wrap the info below the image...kinda cheesy, but it works.
HTML example:
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Furniture</title> <!-- META TAGS //--> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Language" content="en-us"> <!-- STYLESHEETS //--> <style type="text/css"> * {margin:0;padding:0} html,body {height:100%;} body {font:100.01%/110% Arial,Helvetica,sans-serif;background-color:#FFF;} dl.i_lst dd {float:left;display:inline;position:relative;list-style:none;} dl.i_lst dd span {clear:left;font-size:0.86em;text-align:center;text-transform:uppercase;display:block;} dl.i_lst dd img {width:150px;height:112px;} </style> </head> <body> <dl class="i_lst"> <dd> <a href="#"><img src="/photos/DPD-300BKL-1.jpg" width="150" height="112" alt="Sectional D-300"></a> <span><a href="#">Item D-300</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-2.jpg" width="150" height="112" alt="Sectional D-301"></a> <span><a href="#">Item D-301</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-3.jpg" width="150" height="112" alt="Sectional D-302"></a> <span><a href="#">Item D-302</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-4.jpg" width="150" height="112" alt="Sectional D-303"></a> <span><a href="#">Item D-303</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-5.jpg" width="150" height="112" alt="Sectional D-304"></a> <span><a href="#">Item D-304</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-6.jpg" width="150" height="112" alt="Sectional D-305"></a> <span><a href="#">Item D-305</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-7.jpg" width="150" height="112" alt="Sectional D-306"></a> <span><a href="#">Item D-306</a></span> </dd> <dd> <a href="#"><img src="/photos/DPD-300BKL-8.jpg" width="150" height="112" alt="Sectional D-307"></a> <span><a href="#">Item D-307</a></span> </dd> </dl> </body> </html>
Code:require_once("conn.php"); require_once("includes.php"); $query = array(); if(!empty($_GET[c])) { $query[] = "re2_listings.CategoryID = '$_GET[c]' "; } if(!empty($_GET[s])) { $query[] = "re2_listings.SubcategoryID = '$_GET[s]' "; } if(!empty($_GET[search_state])) { $query[] = "re2_listings.state = '$_GET[search_state]' "; } if(!empty($_GET[search_city])) { $query[] = "re2_listings.city = '$_GET[search_city]' "; } if(!empty($query)) { $MyQuery = implode(" and ", $query); $MyQuery = "and ".$MyQuery; } //////////////////////////////////////////////////////////// ////////// order by $order = array(); if(!empty($_GET[orderby])) { $MyOrder = explode("|", $_GET[orderby]); while(list(,$ov) = each($MyOrder)) { if($ov == "DateAdded") { $order[] = " re2_listings.DateAdded desc "; } if($ov == "Price") { $order[] = " re2_listings.Price asc "; } if($ov == "address") { $order[] = " re2_listings.address asc "; } } } else { if(!empty($_GET[p])) { $order[] = " re2_listings.Price asc "; } if(!empty($_GET[r])) { $order[] = " re2_listings.rooms asc, re2_listings.bathrooms asc, re2_listings.garage asc "; } if(!empty($_GET[city])) { $order[] = " re2_listings.city, re2_listings.address, re2_listings.state "; } } if(count($order) > '0') { $MyOrder = implode(", ", $order); } if(empty($MyOrder)) { $MyOrder = " order by re2_agents.PriorityLevel desc, re2_listings.DateAdded desc"; } else { $MyOrder = " order by re2_agents.PriorityLevel desc, $MyOrder"; } if(!empty($_GET[Start])) { $Start = $_GET[Start]; } else { $Start = '0'; } $ByPage = '20'; $q1 = "select * from re2_listings, re2_agents, re2_priority where re2_listings.AgentID = re2_agents.AgentID and re2_agents.PriorityLevel = re2_priority.PriorityLevel and re2_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage "; $qnav = "select * from re2_listings, re2_agents where re2_listings.AgentID = re2_agents.AgentID $MyQuery"; $r1 = mysql_query($q1) or die(mysql_error()); $lrows = mysql_num_rows($r1); if($lrows > '0') { $ListingTable .= "<dl class=\"i_lst\">\n"; while($a1 = mysql_fetch_array($r1)) { if($a1[PriorityLevel] > '1') { $sub = "<span class=RedLink><sup>$a1[PriorityName]</sup></span>"; } if(!empty($a1[image])) { $im_array = explode("|", $a1[image]); $ListingTable .= "<dd><a href=\"window.open('info.php?id=$a1[ListingID]', '_top')\"><img src=\"re_images/$im_array[0]\" width=\"125\" height=\"93\"></a>"; } // Guessing you have something like make or model name as a field $ListingTable .= "<span><a href=\"window.open('info.php?id=$a1[ListingID]', '_top')\">$a1[make] $a1[model]</span></a></dd>"\n\t"; } $ListingTable .= "</dl>"; $rnav = mysql_query($qnav) or die(mysql_error()); $rows = mysql_num_rows($rnav); if($rows > $ByPage) { $ListingTable .= "<br><table align=center width=510>"; $ListingTable .= "<td align=center><font face=verdana size=2> | "; $pages = ceil($rows/$ByPage); for($i = 0; $i <= ($pages); $i++) { $PageStart = $ByPage*$i; $i2 = $i + 1; if($PageStart == $Start) { $links[] = " <span class=RedLink>$i2</span>\n\t "; } elseif($PageStart < $rows) { $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t "; } } $links2 = implode(" | ", $links); $ListingTable .= $links2; $ListingTable .= "| </td>"; $ListingTable .= "</table><br>\n"; } } else { $ListingTable = "<br><br><center>No results were found!</center>"; } require_once("templates/HeaderTemplate.php"); require_once("templates/SearchTemplate.php"); require_once("templates/FooterTemplate.php");
TaliaJLast edited by TaliaJ; May 6, 2006 at 20:17. Reason: Added Code Example
-
May 6, 2006, 19:57 #7
- Join Date
- Jan 2006
- Posts
- 221
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by TaliaJ
Bookmarks