本文整理汇总了PHP中OOCategory::_getCategoryObject方法的典型用法代码示例。如果您正苦于以下问题:PHP OOCategory::_getCategoryObject方法的具体用法?PHP OOCategory::_getCategoryObject怎么用?PHP OOCategory::_getCategoryObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OOCategory
的用法示例。
在下文中一共展示了OOCategory::_getCategoryObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
function &_getCategoryObject($category, $clang = false)
{
if (is_object($category)) {
return $category;
} elseif (is_int($category)) {
return OOCategory::getCategoryById($category, $clang);
} elseif (is_array($category)) {
$catlist = array();
foreach ($category as $cat) {
$catobj = OOCategory::_getCategoryObject($cat, $clang);
if (is_object($catobj)) {
$catlist[] = $catobj;
} else {
return null;
}
}
return $catlist;
}
return null;
}
示例2: get
function get()
{
$s = '';
$s_self = '';
$this->_depth = 0;
if ($this->root_category === null) {
$root_nodes = OOCategory::getRootCategories($this->ignore_offlines, $this->clang);
} else {
if (is_int($this->root_category) && $this->root_category === 0) {
$root_nodes = OOArticle::getRootArticles($this->ignore_offlines, $this->clang);
} else {
$root_nodes = array();
$root_category = OOCategory::_getCategoryObject($this->root_category);
// Rootkategorien selbst nicht anzeigen, nur deren Kind-Elemente
if (is_array($root_category)) {
foreach ($root_category as $root_cat) {
$this->_appendChilds($root_cat, $root_nodes);
$this->_appendArticles($root_cat, $root_nodes);
}
} else {
$this->_appendChilds($root_category, $root_nodes);
$this->_appendArticles($root_category, $root_nodes);
}
}
}
if (is_array($root_nodes)) {
foreach ($root_nodes as $node) {
$s_self .= $this->_formatNode($node);
}
// Parent Tag nur erstellen, wenn auch Childs vorhanden sind
if ($s_self != '') {
$s .= '<' . $this->main_tag . $this->main_attr . '>';
$s .= $s_self;
$s .= '</' . $this->main_tag . '>';
}
}
return $s;
}