$tmpl->cats = array( $tmpl->cats ); } } else { $tmp = Category::getByID($cat); $num = $tmp->number; $tmpl->prev = Category::getByNumber(preg_replace('#\.[\d]+$#','',$num)); $tmpl->cats = Category::getByParent($cat); if( $tmpl->cats instanceof Category ) { $tmpl->items = Item::getByCategory($tmpl->cats->categoryid); } else { $tmpl->items = Item::getByCategory($cat); } if( $tmpl->items instanceof Item ) { $tmpl->items = array( $tmpl->items ); } if( $tmpl->items === false && $tmpl->cats === false ) { unset($tmpl->items); unset($tmpl->cats); $tmpl->code = 0; $tmpl->css = "error"; $tmpl->message = "There are no items to display."; }