Welcome Guest, Not a member yet? Register   Sign In
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



Theme © iAndrew 2016 - Forum software by © MyBB