I want to send a parameter to a joomla component by Get method
This is The URL:
index.php?option=com_bahaedini&search=keyword&view=items&year=yyyy&month=mm&&day=dd
ex:
index.php?option=com_bahaedini&search=ebooks&view=items&year=2000&month=1&&day=20
This is ParseRoute function:
function BahaediniParseRoute($segments)
{
$vars = array();
switch($segments[0])
{
case 'items':
$vars['view'] = 'items';
if(isset($segments[2]))
{
$year = explode( ':', $segments[2] );
$vars['year'] = (int)$year[0];
}
if(isset($segments[3]))
{
$month = explode( ':', $segments[3] );
$vars['month'] = (int)$month[0];
}
if(isset($segments[4]))
{
$day = explode( ':', $segments[4] );
$vars['day'] = (int)$day[0];
}
if(isset($segments[1]))
{
$search = explode( ':', $segments[1] );
$vars['search'] = (int)$search[0];
}
break;
}
return $vars;
Normally The URL changes to:
http://127.0.0.1/component/bahaedini/items/ebooks/1395/1/8
I print them with this method:
echo "<br>s:".$_ss = urldecode($app->input->getString('search'));
echo "<br>y:".$_yy = urldecode($app->input->getString('year'));
echo "<br>m:".$_mm = urldecode($app->input->getString('month'));
echo "<br>d:".$_dd = urldecode($app->input->getString('day'));
result:
ss=ebook/yy=2000/mm=1/dd=8
every thing is normal UNTIL:
If I remove keyword this is the result:
ss=2000/yy=1/mm=8/dd=
Is there a way to solve this problem?