Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.80 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. custom URL mappings in codeigniter like redmine?
  2. http://demo.redmine.org/projects/<project-name>/controller/action
  3.        
  4. http://demo.redmine.org/projects/produto/activity
  5. http://demo.redmine.org/projects/produto/issues/new
  6. http://demo.redmine.org/projects/produto/issues/gantt
  7. http://demo.redmine.org/projects/produto/files
  8.        
  9. // the $1 maps to :any
  10. $route['projects/produto/:any'] = "$1";
  11.  
  12. // the $1 maps to the first any, $2 maps to the second :any
  13. $route['projects/produto/:any/:any'] = "$1/$2";
  14.        
  15. public function _remap($method){
  16. if ($method == 'project-name')
  17. {
  18.     //display project1
  19. }
  20. elseif($method == 'project-name2')
  21. {
  22.     //display project2
  23. }
  24.        
  25. $route['example'] = "controller/function";
  26. $route['example2/(:any)'] = "controller/function";
  27.        
  28. $route['projects/(:any)/(:any)/(:any)'] = "$2/$3/$1";