Marc Marc - 11 months ago 87
HTML Question

Validation notice: "Start tag DIV seen in table"

I'm getting this error running validation: "Start tag div seen in table" that results in "Cannot recover after last error. Any further errors will be ignored".

<div class="post">

$dir = 'img/';
$filetype = '*.*';
$allow = array('jpg');
$files = glob($dir.$filetype);
$newest_images_first = true;
$files = array_reverse($files);
$open = opendir($dir);
while (($file=readdir($open))!==false) {$ext=str_replace('.', '', strrchr($file, '.'));if (in_array($ext, $allow)) $list[$i++]=$file; }
$perPage= 20;
$pageNumber= $thisPage+1;
$perRow= 1;
for ($i=$start;$i<$start+$perPage;$i++)

{ // <---------- this opens element

echo '<div class="item">'; // <----------- this div doesn't open!!

// Preloader
echo '<div class="preloader"></div>';

if (isset($list[$i])) {

echo '<figure>';
echo '<div class="photo">';

$exif = exif_read_data($files[$i], 0, true);
error_reporting(E_ERROR | E_PARSE);
$title = substr($files[$i],strlen($dir),strrpos($files[$i], '.')-strlen($dir));
$title = str_replace( array( '%', '_'), " ", $title);
$title = substr($title, 5);
$title = str_replace( array('', '_'), "", $title);
$imgname = $files[$i];
echo '<img src="'.$imgname.'" alt="blahblah '.$title.'" onLoad="this.width*=0.6;imgLoaded(this);" onError="this.onerror=null;this.src="bundles/blank.svg";">';

echo '</div>'; // .photo

echo '<figcaption>';

$title = preg_replace('/\'([^\']+)\'/', '<em>$1</em>', $title);
echo '<h2>'."". $title .'</h2>';
echo "<p>".$exif['IFD0']['ImageDescription']."</p>";

echo '</figcaption>';
echo '</figure>';


else {
echo "<td></td>";

if ($imgCnt%$perRow==0) echo "</tr><tr>";

echo '</div>'; // .item




</div> <!-- post -->

I have tried many things, yet I could not find the solution. Any ideas what's going on?

Answer Source

Why you don't use tr and td inside your table? div tag inside table tag is incorrect.