• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ROUTES and Functions bug?

#1
[eluser]Unknown[/eluser]
Hi. First, my english is very bad, i'm sorry Smile

Okay, I have an issue with this:

My routes.php look like this:

Code:
$route['articles/(:num)/(:any)'] = "articles/$2/$1";
$route['articles/(:num)/(:any)/(:any)'] = "articles/$2_$3/$1";

Okay, and my "articles" controller contains this:

Code:
function edit($article_id = -1)
{
  echo 'func_edit';
}

function edit_tags($article_id = -1)
{
  echo 'func_edit_tags';
}

Okay, and now, when I request this URL,
/articles/541/edit everything is OKAY. CI requests function 'edit' from controller and output is 'func_edit'

AND ALSO when i request this URL:
/articles/541/edit_tags everything is OKAY. CI requests function 'edit_tags' BUT

I want to request this function like this: /articles/541/edit/tags
and routes look like this:
Code:
$route['articles/(:num)/(:any)/(:any)'] = "articles/$2_$3/$1";

but, this not working.

Any idea? Smile
Thanks.

#2
[eluser]Unknown[/eluser]
Ow.. My fault. ;D

Fixed code:
Code:
$route['articles/(:num)/(:any)/(:any)'] = "articles/$2_$3/$1";
$route['articles/(:num)/(:any)'] = "articles/$2/$1";

I changed order of lines. Ehm... :} Big Grin


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.