本文整理汇总了PHP中XMLElement::getChildrenByName方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement::getChildrenByName方法的具体用法?PHP XMLElement::getChildrenByName怎么用?PHP XMLElement::getChildrenByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLElement
的用法示例。
在下文中一共展示了XMLElement::getChildrenByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertBreadcrumbs
/**
* Allows developers to specify a list of nav items that build the
* path to the current page or, in jargon, "breadcrumbs".
*
* @since Symphony 2.3
* @param array $values
* An array of `XMLElement`'s or strings that compose the path. If breadcrumbs
* already exist, any new item will be appended to the rightmost part of the
* path.
*/
public function insertBreadcrumbs(array $values)
{
if (empty($values)) {
return;
}
if ($this->Breadcrumbs instanceof XMLELement && count($this->Breadcrumbs->getChildrenByName('nav')) === 1) {
$nav = $this->Breadcrumbs->getChildrenByName('nav');
$nav = $nav[0];
$p = $nav->getChild(0);
} else {
$p = new XMLElement('p');
$nav = new XMLElement('nav');
$nav->appendChild($p);
$this->Breadcrumbs->prependChild($nav);
}
foreach ($values as $v) {
$p->appendChild($v);
$p->appendChild(new XMLElement('span', '›', array('class' => 'sep')));
}
}