Welcome Guest, Not a member yet? Register   Sign In
Lovely User URLS (http://domain.net/~Username)
#30

[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>&lt;?php echo $segments; ?&gt;</p>

<p><br />Page rendered in {elapsed_time} seconds</p>

&lt;/body&gt;
&lt;/html&gt;

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


Messages In This Thread
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 05:49 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:29 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:47 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:49 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:52 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:52 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:54 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 07:12 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 08:05 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 08:27 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 03:21 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-19-2009, 06:58 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-20-2009, 02:03 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-20-2009, 03:05 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-20-2009, 06:40 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-20-2009, 12:18 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-20-2009, 12:31 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-23-2009, 12:41 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-23-2009, 01:21 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 01-23-2009, 01:26 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 03-29-2009, 07:45 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 03-29-2009, 08:11 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 03-29-2009, 10:45 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 03-30-2009, 07:05 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 03-30-2009, 07:25 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 04-01-2009, 09:00 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 05-08-2009, 08:08 AM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 05-08-2009, 12:52 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 05-08-2009, 02:33 PM
Lovely User URLS (http://domain.net/~Username) - by El Forum - 06-14-2009, 03:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB