roldahayes Posted December 12, 2007 Share Posted December 12, 2007 hope this is all going to make sense... I use a Csv to populate a search and results system. We have now included a faility to have a small thumbnail at the start of the page running of a folder on the server that the csv points to. On the description field, there is a url link to a pop up window for each product that again is determined from another colum in the csv file. My question is... Can the thumbnail code be adjusted so that it ALSO points to the "more information" link that appears in the description?? example of the results page is here http://www.autorack.co.uk/leisure_results.php?make=VAUXHALL++--------+car+roof+rack+products&model=Astra+5-d+ESTATE+with+roofrailing%2C+04+-&submit=Click+here+to+search. code for the part i need adjusting is here. Cheers <?php $title = "<tr align=\"center\" class=\"headertable\" height=\"32\">"; $title .= "<td width=\"100\"><img src=\"images/transparent.gif\" width=\"100\" height=\"1\" /></td>"; $title .= "<td width=\"60\">Make</td>"; $title .= "<td width=\"60\">Ref No.</td>"; $title .= "<td width=\"550\">Title/Description</td>"; $title .= "<td width=\"73\">Price Ex VAT</td>"; $title .= "<td width=\"73\">Price Inc VAT</td>"; $title .= "<td width=\"60\"><img src=\"2003/basket.gif\" width=\"21\" height=\"14\"></td>"; $title .= "</tr>"; //set the counters for the records results display screen $cnt = 0; $headercount1 = 0; $headercount2 = 0; $headercount3 = 0; $headercount4 = 0; $headercount5 = 0; $headercount6 = 0; $headercount7 = 0; while ($row = mysql_fetch_assoc($result)) { //cut the prod_type variable //get the length of the variable $strLength = strlen ($row["Prod_Type"]); //assign first 2 characters of variable $strPrefix = substr($row["Prod_Type"], 0, 2); //debug //echo "\n prefix :" . $strPrefix; //assign remaining characters of variable $strSuffix = substr($row["Prod_Type"], 2, $strLength); //debug //echo "\n suffix :" . $strSuffix; //set product header image depending on the Prod_Type Code //start the table row echo "<tr align=left><td colspan=7 class=small>"; //set bg cell color diff for BH make switch ($strPrefix) { case "BH": $color=$color2; break; default: $color=$color1; break; }//end switch switch ($strPrefix) { case "DG": if ($headercount1 == 0) { echo "<img border=0 src=2003/searchheaders/ldogguards.jpg alt=Dog Guards></td></tr>"; echo $title; } $headercount1 ++; //$headercount1 break; case "LB": if ($headercount2 == 0) { echo "<img border=0 src=2003/searchheaders/lroofbars.jpg alt=Roof-Bars></td></tr>"; echo $title; } $headercount2 ++; //$headercount1 break; case "RB": if ($headercount2 == 0) { echo "<img border=0 src=2003/searchheaders/lroofbars.jpg alt=Roof-Bars></td></tr>"; echo $title; } $headercount2 ++; //$headercount1 break; case "BX": if ($headercount3 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Roof-Boxes></td></tr>"; echo $title; } $headercount3 ++; //$headercount1 break; case "BR": if ($headercount4 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Bike-Racks></td></tr>"; echo $title; } $headercount4 ++; break; case "SR": if ($headercount5 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Ski-Rack></td></tr>"; echo $title; } $headercount5 ++; break; case "CR": if ($headercount6 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Canoe-Rack></td></tr>"; echo $title; } $headercount6 ++; break; case "XL": if ($headercount7 == 0) { echo "<img border=0 src=2003/searchheaders/lgeneral.jpg alt=General-Accessories></td></tr>"; echo $title; } $headercount7 ++; } // if (($cnt++)%2) // { // $color="#E9E9E9"; // Almost Silver // } // else // { // $color="#E9E9E9";// Light Blue // } //print a product row if the prodtype isn't set to INFO $pop_link = ""; if ($strSuffix != "INFO"){ //test to see if an image exists for the product //test to see if an image exists for the product if ($row["Link"] <> NULL){ $pop_link = " <a href=\"javascript:MM_openBrWindow('products/".$row["Link"]."','pop','scrollbars=yes,resizable=yes,width=500,height=500');\" >More information >>>></a>"; } echo "<tr class=stdtable align=center height=25>"; //DISPLAY THUMB IMAGE IF ONE WAS LISTED IN THE image_name FIELD $p_image_name = htmlspecialchars($row["image_name"]); //echo "p_image_name:$p_image_name"; if ($p_image_name != "") echo "<td bgcolor=$color width=\"95\"><img src=\"images/product_images/$p_image_name\" border=\"0\" /></td>"; else echo "<td bgcolor=$color width=\"95\"><img src=\"images/transparent.gif\" width=\"95\" height=\"50\" border=\"0\" /></td>"; echo "<td bgcolor=$color width=\"60\">". htmlspecialchars($row["Prod_Make"]) . "</td><td bgcolor=$color width=\"60\">" . htmlspecialchars($row["Prod_REF"]) . "</td><td bgcolor=$color align=left class=\"infolink\ width=\"550\">" . htmlspecialchars($row["Product_Desc"]) . $pop_link . "</td><td bgcolor=$color width=\"73\">£" . number_format(htmlspecialchars($row['Price_ExVat']), 2) . "</td><td bgcolor=$color width=\"73\">£" . number_format((calcVAT (htmlspecialchars($row['Price_ExVat']))), 2) . "</td><td bgcolor=$color width=\"60\"><a href=basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" . $row["Prod_ID"] . "><img src=2003/buy.gif border=0></a></td></tr>"; } // if the prod type is set to INFO then print out a new row for that information else { echo "<tr class=stdtable align=center height=25 ><td colspan=7 bgcolor=$color_info><em><strong>" . htmlspecialchars($row["Product_Desc"]) . "</em></strong></td></tr>"; } } echo "<tr class=stdtable align=left height=25 ><td colspan=7>"; if ($headercount1 == 0){ echo "<img border=0 src=2003/searchheaders/ldogguards.jpg alt=Dog Guards><br><div align=center> </div></td></tr>"; $headercount1 ++; } //****************************************************************************************************** //get all porducts from the database that are marked with prod_type XD regardless of car make and model /* $sqlSelectDefault = "SELECT Prod_ID, Prod_Type, Prod_Model, Prod_Make, Priority, Prod_Code, Prod_REF, Product_Desc, Price_ExVat FROM products"; $criteriaDefault = " WHERE Prod_Type LIKE '".$strDefaultProd."%' AND Default_Code = 'LE'"; $limitDefault = "ORDER BY Priority ASC, Prod_Code ASC"; // assign the basic sqlquery $sqlqueryDefault = $sqlSelectDefault . $criteriaDefault . $limitDefault ; //echo $sqlqueryDefault; //get the result set $resultDefault = mysql_query($sqlqueryDefault); // if no matches found from query if (!$resultDefault || (mysql_num_rows($resultDefault) == 0)){ //echo ("<b><font class=small>No matches were found.</font></b>"); } // display the results else{ // use rowcount to display total results found $countDefault = mysql_num_rows($resultDefault); //echo $count; //echo("<p>Total Matches Found = " . $rowCount . "</p>"); //*debug } //set product header image depending on the Prod_Type Code //start the table row echo "<tr align=left><td colspan=7 class=small>"; echo "<img border=0 src=2003/searchheaders/lgeneral.jpg alt=General-Accessories>"; echo "</td></tr>"; while ($rowDefault = mysql_fetch_assoc($resultDefault)) { //cut the prod_type variable //get the length of the variable $strLengthDefault = strlen ($rowDefault["Prod_Type"]); //assign first 2 characters of variable $strPrefixDefault = substr($rowDefault["Prod_Type"], 0, 2); //debug //echo htmlspecialchars($rowDefault["Prod_ID"]); //echo "\n prefix :" . $strPrefixDefault; //assign remaining characters of variable $strSuffixDefault = substr($rowDefault["Prod_Type"], 2, $strLengthDefault); //debug //echo "\n suffix :" . $strSuffixDefault; if ($strSuffixDefault != "INFO"){ $color="#E9E9E9"; // Almost Silver //print a product row if the prodtype isn't set to INFO echo "<tr class=stdtable align=center height=25 ><td bgcolor=$color>". htmlspecialchars($rowDefault["Prod_Make"]) . "</td><td bgcolor=$color>" . htmlspecialchars($rowDefault["Prod_REF"]) . "</td><td bgcolor=$color align=left>" . htmlspecialchars($rowDefault["Product_Desc"]) . "</td><td bgcolor=$color>�" . number_format(htmlspecialchars($rowDefault['Price_ExVat']), 2) . "</td><td bgcolor=$color>�" . number_format((calcVAT (htmlspecialchars($rowDefault['Price_ExVat']))), 2) . "</td><td bgcolor=$color><a href=basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" . $rowDefault["Prod_ID"] . "><img src=2003/buy.gif border=0></a></td></tr>"; } // if the prod type is set to INFO then print out a new row for that information else { echo "<tr class=stdtable align=center height=25 ><td colspan=7 bgcolor=$color><em>" . htmlspecialchars($rowDefault["Product_Desc"]) . "</em></td></tr>"; } } */ ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.