<?php 
/**
* @package Categorie Menu  for Joomla 1.5.x
* @module Categorie Menu
* @created by Conny Henn   (C) 2009
* @url http://www.HennWeb.de
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

// Übergabe Variablen aus Browserzeile auslesen
$Itemid = JRequest::getInt('Itemid', 0);

// Steuer Variablen aus der XML lesen
$showid = $params->get('showid');
$maxMeng = $params->get('count');
//added a value which checks for the ordering "default is ordering"
$orderby = $params->get('orderby');

echo $xshowid;
// SQL Abfrage erstellen
//$query = 'SELECT * FROM #__content where catid='.$showid.' AND state = 1 ORDER BY '.$orderby.' ';

// Create SQL query 
$now = &JFactory::getDate();
$query = 'SELECT * FROM #__content where catid='.$showid.' AND state = 1 AND publish_up <= "'.$now->toMysql().'" ORDER BY '.$orderby.' ';

IF ($maxMeng <> 0) {
	$query .= ' LIMIT '.$maxMeng; 
}
// Datenbank Abfrage
$db    =& JFactory::getDBO();	
		  $db->setQuery($query);
$result = $db->loadObjectList();

?>
