What i need this to do is delete what is inside the div eliment already before it writes the the div again. If anyone can help me i give my thanks, :)
<?php
$file = "./test.html";
$imgs = glob("1/*.*");
$dom = new DOMDocument();
$dom->loadHTMLFile($file);
$container = $dom->getElementByID("container");
if(count($imgs) == 0 || $imgs === false)
die('Error: glob is failing.');
foreach($imgs as $img)
{
$basename = pathinfo($img, PATHINFO_BASENAME);
$tag = $dom->createElement("img");
$tag->setAttribute('src', '1/'.$basename);
$container->appendChild($tag);
$tag = null;
}
$dom->saveHTMLFile($file);
?>