• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with constructor and URI

#6
[eluser]InsiteFX[/eluser]
Use _remap method
Code:
// ./application/config/routes.php
// ------------------------------------------------------------------------
/**
* DO NOT! REMOVE THIS LINE
* This is for the members _remap. Must be the last line in routes file!!!
* ------------------------------------------------------------------------
*/
$route['(.*)'] = 'welcome/index/$1';
// ------------------- -== DO NOT REMOVE! the above line ==- --------------

// Controller index method
// --------------------------------------------------------------------

/**
* index()
*
* index - default method called.
*
* @access public
* @return void
*/
public function index($member = NULL)
{
    if ( ! empty($member))
    {
        // URL contains a member name!
    }
    else
    {
        // No member name passed!
    }
}

// _remap method

// --------------------------------------------------------------------

/**
* _remap()
*
* Remaps the URL segments.
*
* @access private
* @param string
* @param array
* @return mixed
*/
public function _remap($method, $params = array())
{
    if (method_exists($this, $method))
    {
        return call_user_func_array(array($this, $method), $params);
    }

    show_404();
}


Messages In This Thread
Problem with constructor and URI - by El Forum - 04-27-2011, 11:07 AM
Problem with constructor and URI - by El Forum - 04-27-2011, 11:26 AM
Problem with constructor and URI - by El Forum - 04-27-2011, 11:38 AM
Problem with constructor and URI - by El Forum - 04-27-2011, 12:21 PM
Problem with constructor and URI - by El Forum - 02-11-2012, 09:52 PM
Problem with constructor and URI - by El Forum - 02-11-2012, 11:15 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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