Welcome Guest, Not a member yet? Register   Sign In
Routing problems
#1

[eluser]dalebotha[/eluser]
Hi!

I'm having problems understanding how routing works. I read the users guide but I haven't been able to apply it to what I'm doing. Help will be appreciated!

I've got:

- Pages Controller pointed to a pages table in my db.
- I'd like each entry in the pages table to look like this in the URL
home -> www.eg.com/home
about -> www.eg.com/about

Here is my index action in Pages Controller:
Code:
function Pages()
        {
            parent::Controller();
            
            $this->table = 'pages';
            $this->view_type_table = 'view_types';
                        
            $this->load->model('Pages_model', 'page', true);
            
            $this->template['navigation'] = $this->page->nav();
        }
function index()
        {

            
            if ( ! $path = $this->uri->segment(1))
            {
                $path = 'home';
            }

            if ( $this->template['page'] = $this->page->get($path) )
            {
                if ( $type_id = $this->template['page']['type_id'] )
                {
                    $view_type = $this->page->get_view_type($type_id);
                    $this->template['view_type'] = $view_type['name'];
                    $this->_run();
                }
                
            }
            else
            {
                die('404! oops... :(');
            }
            
        }

I watched Elliot Haughin's screencasts so a lot of this come from him. This is in my httpd.conf:
Code:
<Directory "/absolute/url/codeignitor/">

Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
AllowOverride All

</Directory>
...and this is my .htaccess:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

Is this enough info to have a clue? It seems there are soo many factors a play here that I really have no clue where it's going wrong and how to debug it!

Would anybody be able to help me?

Thanks, Dale


Messages In This Thread
Routing problems - by El Forum - 10-19-2008, 01:59 PM
Routing problems - by El Forum - 10-20-2008, 05:53 PM
Routing problems - by El Forum - 10-22-2008, 04:53 AM
Routing problems - by El Forum - 10-22-2008, 07:15 AM
Routing problems - by El Forum - 10-22-2008, 10:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB