Welcome Guest, Not a member yet? Register   Sign In
How to skip/index/ in uri-segment
#5

[eluser]vrencianz[/eluser]
I am glad that the problem is solved.

My problem with this solution is that if that other controller functions will inhibit parameters to the initial index().

For example:

Code:
class Test extends CI_Controller
{
/*
function index()
{
  echo $this->uri->segment(2);
  echo $this->uri->segment(3);
}
*/
function shoes()
{
  echo $this->uri->segment(2);
  echo $this->uri->segment(3);
}

function lists()
{
  echo $this->uri->segment(2);
  echo $this->uri->segment(3);
}

function _remap($method)
{
  echo 'remap<br/>';

  if($method === 'shoes')
  {
   $this->shoes();
  }
  else if($method === 'lists')
  {
   $this->lists();
  }
  else
  {
   echo 'processing: '.$method;
  }
}
}

1) let suppose that the initial class worked for <b>test/index/shoes</b>
2) with this remap <b>test/shoes</b> won't work anymore the same ($this->shoes() is called instead)

So, the developer must take care to avoid function names that match with all possible parameters to the initial index(). Because of, theoretically, any url is possible (user input from db, like id-s, names) this is not achievable.

I hope you understand my concerns. Smile

Cheers!


Messages In This Thread
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 09:20 AM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 09:59 AM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 11:19 AM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 11:59 AM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 12:42 PM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 12:45 PM
How to skip/index/ in uri-segment - by El Forum - 04-24-2012, 01:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB