madmega Posted February 17, 2010 Share Posted February 17, 2010 Hi my script loads a CSV file, divides it in 6 coloms, and shows normally 30 items on the page. I programmed it so that for 1 row or product it has 6 items (from the csv). As you can see on www.dwmusicstore.com/mark/hollow3.php I made it now so it only shows 3 products. What i want is that it shows the 3 on the row, but after 3 it goes to the next row. Like this A B C D E F G H I because if i change the script that it shows 30 products, it puts the 30 products on 1 row. here is the script: <html> <head> </head> <body bgcolor=#E2E965 link=#E2E965 vlink=#E2E965 alink=#E2E965 text=#D5DF23> <style type="text/css"> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> <table width=900> <tr> <td> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 3; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 4010) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); ?> <td> <?php echo "<p style='margin:9px;'><table BACKGROUND='background.jpg' border=0><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; ?> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b></html> <?php echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <a href="#" title="Koop <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='50' align='right'></a> <?php echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; }} fclose($file_handle); ?> </tr></td></table> <html> <head> <body> <script language="Javascript"> <!-- if (document.images) { image1 = new Image image2 = new Image image1.src = 'vorige1.jpg' image2.src = 'vorige2.jpg' image3 = new Image image4 = new Image image3.src = 'volgende1.jpg' image4.src = 'volgende2.jpg' } --> </script> </head> </body> <center><a href="hollow.php?offset=<?php echo $row2;?>" onMouseOver="document.mouseover.src=image2.src" onMouseOut="document.mouseover.src=image1.src"><img src="vorige1.jpg" border=0 name="mouseover"></a> <a href="hollow.php?offset=<?php echo $row;?>" onMouseOver="document.mouseover2.src=image4.src" onMouseOut="document.mouseover2.src=image3.src"><img src="volgende1.jpg" border=0 name="mouseover2"></a> </center> </html> Quote Link to comment Share on other sites More sharing options...
trq Posted February 17, 2010 Share Posted February 17, 2010 Take a look here. Quote Link to comment Share on other sites More sharing options...
madmega Posted February 17, 2010 Author Share Posted February 17, 2010 I find it very difficult to ad this to the script, i do not know where to begin, both the scripts are usable but i don't know how to implement it. 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.