2

This is my basic file structure

/system
- /application
- /config
- - -routes.php
- /controllers
- - -about.php
- - -home.php
- - /admin
- - - -dashboard.php
- - - -login.php
- - - -news.php

And in routes:

$route['admin']        = 'admin/dashboard'; //This should be the default.
$route['admin/(:any)'] = 'admin/$1';

Browsing to http://mywebsite.com/admin results in this error;

An Error Was Encountered

Unable to load the requested file: dashboard.php

I've read the documentation on controllers and sub-folders are supported. What am I doing wrong here?

2 Answers 2

1

The file dashboard.php was a view, not a controller.

I had a line $this->view->load('no/folder/here/dashboard.php'); which was throwing the error.

It's probably a good idea to name all the view files view_dashboard.php to help identify which file does what.

Sign up to request clarification or add additional context in comments.

Comments

1

Only because the someone has fubar'd the proper folder structure, there should be a 'views' folder which would avoid any confusion :/

2 Comments

It is in the views folder. It just isn't too helpful when the error doesn't tell me which folder or which line the error has occurred on. Maybe I should have a debug log running :)
Ahh sorry matey, I thought the basic structure you posted was complete ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.