[eluser]Jelenik[/eluser]
Dear community,
I am developing application where I have id of item in each url (there is no index page, visitor has to have correct link to detail for location info). So I implemented control check in my init() function, which I am calling in each controller.
So I have library Project.php and there init() function:
Code:
function init($uri_segment)
{
$data['uri_array'] = $this->_CI->uri->uri_to_assoc($uri_segment, array( 'id' ));
/*
* HERE IS CHECKING FUNCTION - it just calls show_404() function
* in case I wont fetch any proper result from database otherwise
* it will continue normally
*/
return $data;
}
Then I have controller Book.php and there function:
Code:
function index()
{
$data = $this->project->init(2);
$default_pars = array('id', 'day_id');
$data['uri_array'] = $this->uri->uri_to_assoc(2, $default_pars);
var_dump($data['uri_array']);
}
If I visit url where day_id segment is not present, I would expect that key 'day_id' will be still present in $data['uri_array'] - but it isnt.. Any idea why it ignored my second $default_pars? Isnt that bug? I would expect that when calling uri_to_assoc second time that it will overwrite previous settings (default_pars).