Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapters #19

Open
augustohp opened this issue Mar 28, 2012 · 3 comments
Open

Adapters #19

augustohp opened this issue Mar 28, 2012 · 3 comments
Labels

Comments

@augustohp
Copy link
Member

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?

@nickl-
Copy link
Member

nickl- commented Jun 3, 2012

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?

@augustohp
Copy link
Member Author

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

@nickl-
Copy link
Member

nickl- commented Jul 7, 2012

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants