[eluser]calumogg[/eluser]
Hi everyone I have tried using the code posted but cant get it working. Here is the code I am using (I have only changed the $segments array and moved
Code:
return parent::_validate_request($segments);
)
Code:
<?php
class MY_Router extends CI_Router {
function MY_Router()
{
parent::CI_Router();
}
function _validate_request($segments)
{
// Does the requested controller NOT exist?
if (!file_exists(APPPATH.'controllers/'.$segments[0].EXT))
{
$segments = array("user","about",$segments[0]);
}
return parent::_validate_request($segments);
}
}
?>
Then here is my user controller:
Code:
<?php
class User extends Controller {
function about(){
$this->load->view('user', $segments);
}
}
?>
And finally my view code:
Code:
<html>
<head>
<title>Users</title>
</head>
<body>
<h1>Users</h1>
<p><?php echo $segments; ?></p>
<p><br />Page rendered in {elapsed_time} seconds</p>
</body>
</html>
I am very new to codeigniter and havent been able to get this working it just keeps telling me $segments is undefined. Please can someone show my how to pass the username as $segments from the routing page. I am testing the script on Wamp server apache v 2.2.11 PHP 5.2.9-2
Thanks in advnace