Welcome Guest, Not a member yet? Register   Sign In
URI Routing and folders in views folders
#1

[eluser]sehummel[/eluser]
I've read the manual on URI routing and views and something is not clicking with me.

In my views folder, I have a subfolder called products. In there is a file called product_view. In my controller, I have:

Code:
function index() {
            $data['title'] = 'Product Overview';
            $data['main_content'] = 'products/product_view';
            $this->load->view('templates/main.php', $data);
        }

The template loads a header view, a footer view and a navigation view, plus the view as a main content variable.

In my URI routing, I have:

Code:
$route['products/product-overview'] = 'products/product_view']

This causes a 404 error when I try to go to domain.com/products/product-overview. Do I need to do something with my .htaccess? If so, what? Here is my .htaccess:

Code:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

I'd appreciate some specific help, as the documentation isn't specific on how to address this. I've done a little searching in the forums, and didn't see anything, but I'm posting this while I keep looking.
#2

[eluser]sooner[/eluser]
you should not try to access the view from the url....u need to access the controller and then the controller loads the view...so call the controller....




Theme © iAndrew 2016 - Forum software by © MyBB