<?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');

// get current article id for compare with row->id
   $myaid = JRequest::getVar('id', 0, '', 'int');

// initialize handler for core value reading
   $mycv =& JFactory::getApplication();
   $sefstate = $mycv->getCfg('sef'); //read a core value

/* #### Output starts #### */
echo "<ul class=\"menu\">";
foreach ($result as $row){
	$linkurl = "index.php?option=com_flexicontent&view=items&cid=".$Itemid"&id=".$row->id;
	//is SEF active than transform generated URL
	if ($sefstate == 1){
		if (!$firstitem) { //JRoute seems to be buggy so we fix what it messes up
			$linkurl = JRoute::_($linkurl)."/".$row->id."-".$row->alias;
 			$firstitem = 1;
			}else{
			$linkurl = JRoute::_($linkurl)."-".$row->alias;
			$linkurl = JRoute::_($linkurl)."/".$row->id."-".$row->alias;
		}
	}
	
	if ($myaid == $row->id){
		 echo "<li id=\"sub_current\" class=\"cat_item".$row->id."\"><a class=\"jcepopup\" href='".$linkurl."'>".str_replace("|","<br>",$row->title)."</a></li>";
		}else{
		 echo "<li class=\"cat_item".$row->id."\"><a class=\"jcepopup\" href='".$linkurl."'>".str_replace("|","<br>",$row->title)."</a></li>";
		}
	}
echo "</ul>";