开发者

An easy way to display prototype nodes in PHP?

开发者 https://www.devze.com 2022-12-12 13:31 出处:网络
It\'s a kind of UI second flavor, functi开发者_JAVA技巧on UISecond($elements) { } So that this functions shows the specified elements(with name,id and type) which is neccesary,but not too picky ab

It's a kind of UI second flavor,

functi开发者_JAVA技巧on UISecond($elements)
{

}

So that this functions shows the specified elements(with name,id and type) which is neccesary,but not too picky about how exactly it's displayed.

EDIT

Give it an array,output the HTML.

Anyone has tried this?

EDIT AGAIN

I want to develop a render engine like drupal's,which takes the array as parameter,and outputs the HTML automatically.


I think you're looking for Krumo.


Are you talking about something like this?

function UISecond($elements)
{
    foreach($elements as $_elem)
    {
        echo "<{$_elem['type']}";
        foreach($_elem['attribute'] as $_name => $_contents) {
            echo " {$_name}=\"{$_contents}\"";
        }
        echo ">{$_elem['innerHTML']}</{$_elem['type']}>";
    }
}

Either way, half of getting a good answer is writing a good problem description ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号