Adapters
We must implement/create a number of Adapters that transform `arraystoDomElements`` to be appended to the document. There is a simple adapter example (Adapters/A.php), but we must accept more situations to adapt:
- ul, li, dl
- tables
Can you come up with more ideas?
Are the adapters still a requirement as it seems HtmlElement manages quite fine without?
<?php
public function getDOMNode(DOMDocument $dom, $current=null)
{
if (is_string($current))
return new DOMText($current);
$current = $current ?: $this ;
$node = $dom->createElement($current->nodeName);
foreach ($current->attributes as $name=>$value)
$node->setAttribute($name, $value);
if (!count($current->childrenNodes))
return $node;
foreach ($current->childrenNodes as $child)
$node->appendChild($this->getDOMNode($dom, $child));
return $node;
}
Should we maybe refactor and remove adapters?
Been following this for quite some time. This week discussions came up and this document was raised again. I don't like it and maybe I didn't get it, but we really COULD use the insertion modes described as ou Adapters implementation.
Let me know what you think on the HTML Template
Will need to read it again, why they want to make things so complicating no one will know.
That comment of mine is very dated and I answered myself by rewriting the module 5 times now already. Have yo looked at the simple_html_dom?