I have Browse the web and prepare a router file for my component com_listing by using instruction on following link
http://forum.joomla.org/viewtopic.php?t=611587
Here is my code of router file
function listingBuildRoute(& $query)
{
$segments = array();
if(isset($query['view']))
{
$segments[] = $query['view'];
unset( $query['view'] );
}
if(isset($query['task']))
{
$segments[] = $query['task'];
unset( $query['task'] );
};
if(isset($query['id']))
{
$segments[] = $query['id'];
unset( $query['id'] );
};
if(isset($query['type']))
{
$segments[] = $query['type'];
unset( $query['type'] );
};
return $segments;
}
function listingParseRoute($segments)
{
$vars = array();
switch($segments[0])
{
case 'accomodation':
$vars['view'] = 'accomodation';
$id = explode( ':', $segments[2] );
$vars['type'] = (int) $id[0];
break;
case 'entertainment':
$vars['view'] = 'entertainment';
$id = explode( ':', $segments[2] );
$vars['type'] = (int) $id[0];
break;
}
switch($segments[1])
{
case 'listing':
$vars['task'] = 'listing';
$vars['task'] =$segments[1];
break;
case 'details':
$vars['task'] = 'details';
$vars['task'] =$segments[1];
break;
}
return $vars;
}
It is preparing the URL Successfully as say for a task "listing" and variable "type" the URl is
index.php/component/listing/entertainment/listing/11
but it is not actuly going in the task listing.It is just showing the view entertainment.I think parse route function is not calling properly But i am not reaching to the correct solution.Please Help