Example #1
0
	$tmpl->code = -1;
	
	if( $cat == -1 )
	{
		$tmpl->cats = Category::getTopLevel();
		$tmp->categoryid = -1;
		if( $tmpl->cats instanceof Category )
		{
			$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 );
		}