Welcome Guest, Not a member yet? Register   Sign In
default_controller can't be in directory
#1

[eluser]Cong Do[/eluser]
default_controller can't be in directory

by replacing the following code in router.php in 1.61

//$this->set_class($this->default_controller);
//$this->set_method('index');
//$this->_set_request(array($this->default_controller, 'index'));

to this Big Grin
$this->_set_request(explode('/',$this->default_controller));

It just work
#2

[eluser]Phil Sturgeon[/eluser]
That will let it work fine if you have a / in there, but will break if you dont. If you were to try the code:

Code:
if(strpos('/', $this->default_controller)):
$this->_set_request(explode(’/’,$this->default_controller) + array('index'));

else:

$this->set_class($this->default_controller);
$this->set_method('index');
$this->_set_request(array($this->default_controller, 'index'));

endif;

Give that one a try, should do both.
#3

[eluser]Unknown[/eluser]
strpos just doesnt want to work, preg_match works just fine though.

Code:
if(preg_match('(/)', $this->default_controller)) {
    
    $this->_set_request(explode('/',$this->default_controller));

} else {

    $this->set_class($this->default_controller);
    $this->set_method('index');
    $this->_set_request(array($this->default_controller, 'index'));

}
#4

[eluser]Seppo[/eluser]
Code:
if (strpos('/', $this->default_controller) !== FALSE)

That way should work... the / can be the first character, so strpos would return 0 and it will evaluate as false




Theme © iAndrew 2016 - Forum software by © MyBB