本文整理汇总了PHP中Node::getChilds方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getChilds方法的具体用法?PHP Node::getChilds怎么用?PHP Node::getChilds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::getChilds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$raw, Document &$document, Node &$parent = null)
{
$this->raw =& $raw;
//$this->document = &$document;
$this->parent =& $parent;
if ($this->parent) {
$this->inParentIndex = count($this->parent->getChilds());
}
$this->process($document);
$this->isSelfClosing = $document->isSelfClosing($this->getName());
}
示例2: interpret
public function interpret(Node &$node){
$name = $node->getAttribute('#');
$childs = $node->getChilds();
if($name != ''){
$ret = '<'.$name;
}else{
$ret = '<Node noname="true"';
}
foreach ($node->attrs as $k => $v){
if(!in_array($k[0], array('#', '>', '@'))){
$ret .= ' '.$k.'="'.$v.'"';
}
}
for($i=0; $i<$node->atidx; ++$i){
$ret .= ' attr'.$i.'="'.$node->attrs['@'.$i].'"';
}
$ret .='>';
foreach ($childs as $child){
$ret .= $this->interpret($child);
}
if($name != ''){
$ret .= '</'.$name.'>';
}else{
$ret .= '</Node>';
}
return $ret;
}
示例3: interpret
public function interpret(Node $node){
$childs = $node->getChilds();
$ret = '';
foreach ($childs as $child){
$ret .= $this->parentInterpreter->interpret($child);
}
return $ret;
}
示例4: interpret
public function interpret(Node &$node, $intent = 0){
$name = $node->getAttribute('#');
$childs = $node->getChilds();
if($name != ''){
$ret = $this->getIntent($intent).$name;
}else{
$ret = $this->getIntent($intent);
}
$hasAttr = false;
for($i=0; $i<$node->atidx; ++$i){
if(!$hasAttr){
$hasAttr = true;
$ret .= '(';
}
$ret .= '"'.$node->attrs['@'.$i].'", ';
}
foreach ($node->attrs as $k => $v){
if(!in_array($k[0], array('#', '>', '@'))){
if(!$hasAttr){
$hasAttr = true;
$ret .= '(';
}
$ret .= $k.'="'.$v.'", ';
}
}
if($hasAttr){
$ret .= ')';
}
$hasChild = false;
foreach ($childs as $child){
if(!$hasChild){
$ret .= '{'.chr(10);
$hasChild = true;
}
$ret .= $this->interpret($child, $intent+1);
}
if($hasChild){
$ret .= $this->getIntent($intent).'}';
}
$ret.=chr(10);
return $ret;
}
示例5: select
function select(Node $node){
$id = $node->getAttribute('id');
$dvalue = $node->getAttribute('@1');
$text = $node->getAttribute('@0');
$options = $node->getChilds();
$selected = $node->getAttribute('selected');
$ret = '<label for="'.$id.'">'.$text.'</label>';
$ret .= '<select name="'.$id.'" id="'.$id.'">';
foreach ($options as $option){
$val = $option->getAttribute('@0');
$text = $option->getAttribute('@1');
if($selected == $val){
$ret .= '<option value="'.$val.'" selected="true">'.$text.'</option>';
}else{
$ret .= '<option value="'.$val.'">'.$text.'</option>';
}
}
$ret .= '</select>';
return $ret;
}
示例6: divider
function divider(Node $node, Node $parent){
$text = $node->getAttribute('@0');
$count = $node->getAttribute('@1');
$ret = '<li data-role="list-divider">';
if($text != ''){
$ret .= $text;
}
if($count != ''){
if($count == 'auto'){
$childs = $parent->getChilds();
$count = (count($childs)-1);
}
$ret.='<span class="ui-li-count">'.$count.'</span>';
}
$ret .= '</li>';
return $ret;
}