tayl1684 Posted January 13, 2005 Share Posted January 13, 2005 Hi I need some help with the formating of the current auctions mod, at the moment its displaying like so: Its creating an extra column on the right for the title when it should span accross all 6 existing columns. This is the code: <?php/* $Id: current_auctions.php,v 1.22 2003/06/05 23:26:22 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ //Thumbs = 0 for no thumbnails(could not do it from database) $thumbs = "1"; require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CURRENT_AUCTIONS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CURRENT_AUCTIONS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE . ' - ' . HEADING_TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'ebay.gif'); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"> <?php // Start the border table echo " <TABLE border=\"0\" cellPadding=\"0\" cellSpacing=\"0\" width=\"100%\"> <TR><TD bgcolor=\"" . EBAY_TBLBORDER . "\"><TABLE border=\"0\" cellPadding=\"2\" cellSpacing=\"1\" width=\"100%\"> <TR> <tr bgcolor=\"" . EBAY_TBLHEADER . "\" valign=\"middle\"> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_ITEM . "</font></b></td> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_START_DATE . "</font></b></td> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_END_DATE . "</font></b></td> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_TIME_LEFT . "</font></b></td> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_CURRENT_PRICE . "</font></b></td> <td align=\"center\" width=\"20%\"><b><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\">" . AUCTION_HIGH_BIDDER . "</font></b></td> </TR> "; // Build the eBay URL $URL = "http://cgi6.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=ViewListedItems&userid=" . EBAY_USERID . "&since=" . EBAY_ENDED . "&sort=" . EBAY_SORT . "&rows=0"; // Set Start and End $Start = "Click on the column headers to sort"; //$End = "</p><script SRC=\"http://include.ebay.com/aw/pics/js/stats/ss.js\"></SCRIPT><script SRC=\"http://include.ebay.com/aw/pics/js/stats/ss2.js\"></SCRIPT><p>" or "indicates that auction has ended."; // Open the file $file = fopen("$URL", "r"); // Read the file if (!function_exists('file_get_contents')) { $r = fread($file, 80000); } else { $r = file_get_contents($URL); } // Grab the desired contents $stuff = eregi("$Start(.*)$End", $r, $content); // Get rid of unnecessary data // Set data up to be split into lines and items $content[1] = ereg_replace("</a><table border=\"1\" cellpadding=\"3\".*</td><br></tr>","",$content[1]); $content[1] = ereg_replace("<tr bgcolor=\"#CCCCFF\">.*High Bidder \/ Status","",$content[1]); $content[1] = ereg_replace("<tr bgcolor=\"#CCCCFF\">.*High Bidder \/ Status","",$content[1]); $content[1] = str_replace("</table>", "", $content[1]); $content[1] = str_replace("</th>", "", $content[1]); $content[1] = str_replace("\r\n", "", $content[1]); $content[1] = str_replace("\n", "", $content[1]); $content[1] = str_replace("\r", "", $content[1]); $content[1] = str_replace("<td align=\"center\">", "", $content[1]); $content[1] = str_replace("<td>", "", $content[1]); $content[1] = str_replace("<td align=\"right\">", "", $content[1]); $content[1] = str_replace("<font color=\"\">", "", $content[1]); $content[1] = str_replace("</font>", "", $content[1]); $content[1] = str_replace("<tr bgcolor=\"#ffffff\">", "", $content[1]); $content[1] = str_replace("<tr bgcolor=\"#efefef\">", "", $content[1]); $content[1] = str_replace("<tr bgcolor=\"#efefef\">", "", $content[1]); $content[1] = str_replace("</td>", "[iTEMS]", $content[1]); $content[1] = str_replace("</tr>", "[LINES]\n", $content[1]); // Line used during debug //echo "<hr>$content[1]<br><br> <hr>"; // Close the file fclose($file); $stuff = $content[1]; // Build the first array for EOF $items = explode("[LINES]",$stuff); // Loop through the lines $count = "0"; foreach ($items as $listing) { // Break lines into individual items list($Item,$Start,$End,$Price,$Title,$HighBidder ) = explode("[iTEMS]",$listing); // Remove the (*) from the High Bidder $HighBidder = str_replace("(*)" , "" , $HighBidder); //Countdown to retrieve Time Left //Break apart End and convert the months to numbers $seperate = split('[- :]', $End); $seperate[0] = str_replace("Jan", "1", $seperate[0]); $seperate[0] = str_replace("Feb", "2", $seperate[0]); $seperate[0] = str_replace("Mar", "3", $seperate[0]); $seperate[0] = str_replace("Apr", "4", $seperate[0]); $seperate[0] = str_replace("May", "5", $seperate[0]); $seperate[0] = str_replace("Jun", "6", $seperate[0]); $seperate[0] = str_replace("Jul", "7", $seperate[0]); $seperate[0] = str_replace("Aug", "8", $seperate[0]); $seperate[0] = str_replace("Sep", "9", $seperate[0]); $seperate[0] = str_replace("Oct", "10", $seperate[0]); $seperate[0] = str_replace("Nov", "11", $seperate[0]); $seperate[0] = str_replace("Dec", "12", $seperate[0]); $month = $seperate[0]; $day = $seperate[1]; $year = $seperate[2]; $hour = $seperate[3]+EBAY_TIMEZONE; $minute = $seperate[4]; $second = $seperate[5]; // mktime is the marked time, time() is the current time. $target = mktime($hour,$minute,$second,$month,$day,$year); $diff = $target - time(); $days = ($diff - ($diff % 86400)) / 86400; $diff = $diff - ($days * 86400); $hours = ($diff - ($diff % 3600)) / 3600; $diff = $diff - ($hours * 3600); $minutes = ($diff - ($diff % 60)) / 60; $diff = $diff - ($minutes * 60); $seconds = ($diff - ($diff % 1)) / 1; // Put it into a presentable format $Time_Left = $days . "d" . " " . $hours . "h" . " " . $minutes . "m"; // Print Auction Ended when neccassary if ($seconds <= 0) { $TimeLeft = "Auction Ended"; } else { $TimeLeft = $Time_Left; } // Print content if it exists if ($Start && $End && $Title && ($count < EBAY_PERPAGE)) { $count++; $colour = ( $colour == EBAY_TBLROW ) ? EBAY_TBLROWALT : EBAY_TBLROW; $line = "<TR><TD bgcolor=\"$colour\">$Title</TD></TR> <TR><TD bgcolor=\"$colour\" align=\"center\">$Item</TD> <TD bgcolor=\"$colour\">$Start</TD> //<TD bgcolor=\"$colour\">$End</TD> <TD bgcolor=\"$colour\">$TimeLeft</TD> <TD bgcolor=\"$colour\">$Price</TD> <TD bgcolor=\"$colour\">$HighBidder</TD></TR>\n"; preg_match('/item=([^"&]*)/', $line, $match); $itemnum=$match[1]; // Show thumbnails if enabled if ($thumbs == 1) { echo "<tr bgcolor=\"$colour\"> <td align=\"left\" colspan=\"6\"> <font face=\"Arial, sans-serif\" size=\"2\"> <a href=\"http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$itemnum\" target=\"_blank\"><b>$Title</b></a></font></td></tr> <TR><TD bgcolor=\"$colour\" align=\"center\"><a href=\"http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$itemnum\" target=\"_blank\"> <img src=\"http://thumbs.ebay.com/pict/$itemnum.jpg\"border=0></a><br><font face=\"Arial, sans-serif\" size=\"2\">$itemnum</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$Start</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$End</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\" color=\"#FF0000\">$TimeLeft</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><b><font face=\"Arial, sans-serif\" size=\"2\" color=\"#339933\">$Price</font></b></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$HighBidder</font></TD></TR>\n"; } // Otherwise only show Bid Now else { echo "<tr bgcolor=\"$colour\"> <td align=\"left\" colspan=\"6\"> <font face=\"Arial, sans-serif\" size=\"2\"> <a href=\"http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$itemnum\" target=\"_blank\"><b>$Title</b></a></font></td></tr> <TR><TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$itemnum</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$Start</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$End</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\" color=\"#FF0000\">$TimeLeft</font></TD> <TD bgcolor=\"$colour\" align=\"center\"><b><font face=\"Arial, sans-serif\" size=\"2\" color=\"#339933\">$Price</font></b></TD> <TD bgcolor=\"$colour\" align=\"center\"><font face=\"Arial, sans-serif\" size=\"2\">$HighBidder</font></TD></TR>\n"; } } } // Wrap the border table echo "</TABLE></td></tr> </table>"; echo "<TABLE border=\"0\" cellPadding=\"2\" cellSpacing=\"1\" width=\"100%\"> <tr bgcolor=\"" . EBAY_TBLHEADER . "\" valign=\"middle\"> <TD align=\"center\"><font size=\"1\" face=\"Verdana, Arial, sans-serif\" color=\"#FFFFFF\"> <b> " . EBAY_FOOTER . " </b></font></td> </tr> </table>"; ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxOther"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> I highlighted the bit in red that seems to be the key but the colspan function will not seem to work! Any help would be appreciated as my php (and html for that matter) is basic. Many Thanks Ian Quote Link to comment Share on other sites More sharing options...
Pixxi Posted January 26, 2005 Share Posted January 26, 2005 (edited) Hi I need some help with the formating of the current auctions mod, at the moment its displaying like so: Its creating an extra column on the right for the title when it should span accross all 6 existing columns. This is the code: I highlighted the bit in red that seems to be the key but the colspan function will not seem to work! Any help would be appreciated as my php (and html for that matter) is basic. Many Thanks Ian <{POST_SNAPBACK}> Try adding this: / added to remove <td color=""> before $Title ... $content[1] = str_replace("<td color=\"\">", "", $content[1]); at the bottom of the section in the code where the rest of them are. Edited January 26, 2005 by Pixxi Quote Link to comment Share on other sites More sharing options...
tayl1684 Posted January 29, 2005 Author Share Posted January 29, 2005 That worked perfectly, thanks a lot for helping Dee. (Im too stuped to figure out whats going on there but am very gratefull anyway) Thanks again Ian 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.