Inline in my web page I have the following:

$map_container_width = 50;
$map_container_height = 50;
$dom = new DOMDocument('1.0', 'utf-8');

$root = $dom->createElement('div');
$root->setAttribute('id', 'mapContainer');
$root->setAttribute('class', 'mapContainer');

$dom->appendChild($root);

for($i = 0; $i < $map_container_width; $i += 1) {
    for($j=0; $j < $map_container_height; $j += 1) {
        $tileId = 'tile-' . $i . ',' . $j;
        $newTile = $dom->createElement('div');
        $newTile->setAttribute('id', $tileId);
        //echo 'hello ' . $tileId;
        $newTile->setAttribute('class', 'laidTile');

        $root->appendChild($newTile);
    }
}

echo $dom->saveXML();

So my problem is that instead of appending each of the new elements after
each other, this is nesting the new elements inside of each other - anybody
know why? I can't figure it out.

Please help,

-- 
Nathan Lane
Home, http://nathandelane.awardspace.com

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to