Jump to content

Urg! Almost ready to sell site but last fix "ruined site"


mike12255

Recommended Posts

So i was just adding one last feature to a website - light window (its forums are currently unavalible :( ) so anyway im triyng to make it so my code only displays X amount of pics per line which worked untill i added this lightbox crap. Any ideas on how to now make everything appear on the same line??

(error can be seen at: http://www.schoolworkanswers.com/pictures.php?p=1)

 

	    <?php
		if (isset ($_GET['p'])){
$page = $_GET['p'];
}else{
$page = 1;	
}
$itemPerPage = 12;
$offset = ($page - 1) * $itemPerPage;

          		$sql = "SELECT * FROM tbl_pic ORDER BY id DESC LIMIT $offset, 12";
			$sql2 = "SELECT * FROM tbl_pic";

	$result = mysql_query($sql) or die (mysql_error());
	$result2 = mysql_query($sql2) or die (mysql_error());
	$num = mysql_num_rows($result2);

		echo "<tr>";

$cols = 3; // number of columns here
$count = 1;
$rows = 0;
//lets show the images as we find them
while ($row = mysql_fetch_array($result)){
extract($row);


//when the remainder of count divided by cols is 0 do the following....
   if ($count % $cols == 0) {
      echo "</tr>"; // or close a tr and open a new one, etc..
  echo "<tr>";
   }

   $simg = str_replace("../","",$spath); 
    $img = str_replace("../","",$path); 
   echo "<a href=$img class=lightwindow title=ADD author=Kaon caption=$info><img src= $simg border =0></a>";
   
   $count++;
}
echo "</table>";

?>

The problem is that the code below is suposed to stop them from all being on the same line:

 

 
         echo "<tr>";
   
   $cols = 3; // number of columns here
$count = 1;
$rows = 0;
//lets show the images as we find them
   while ($row = mysql_fetch_array($result)){
extract($row);


//when the remainder of count divided by cols is 0 do the following....
   if ($count % $cols == 0) {
      echo "</tr>"; // or close a tr and open a new one, etc..
     echo "<tr>";
   }

   $simg = str_replace("../","",$spath); 
    $img = str_replace("../","",$path); 
   echo "<a href=$img class=lightwindow title=ADD author=Kaon caption=$info><img src= $simg border =0></a>";
   
   $count++;
}

First thing I would say is watch your quotes you have

<a href=images/Photo 101.jpg class=lightwindow title=ADD author=Kaon caption=asdfsdafsdafesd><img src= images/thumbs/Photo 101.jpg border =0></a> 

 

which should be

<a href="images/Photo 101.jpg" class="lightwindow" title="ADD" author="Kaon" caption="asdfsdafsdafesd"><img src= "images/thumbs/Photo 101.jpg" border ="0"></a> 

 

this should clean up quite a few of the errors.

 

Next you are outputting a table and you are making new <tr> instead of <td> for example you should have <tr><td>img</td></tr> to create a new row right now you are just echoing images out in <tr>img</tr> which doesn't really do anything.

 

I ran the site tough w3c validation you have 74 of them most of them can be corrected fairly easily.

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.schoolworkanswers.com%2Fpictures.php%3Fp%3D1

 

brooke

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.