Welcome Guest, Not a member yet? Register   Sign In
Adding admin area
#5

(This post was last modified: 07-13-2018, 07:16 AM by enlivenapp.)

The short version is your route is looking for the Admin Controller with a 'dashboard' Method.  It should be looking for the Admin Controller with the View Method.  You're close, almost there.


To expand and explain a bit on previous answers;  

I've assumed you've not removed index.php from your URL below and in application/config/config.php `base_url` = 'http://example.com'

according to your controller's default $page = 'dashboard'
PHP Code:
$route['admin'] = 'admin/view'
would give you the dashboard.php view when you call the URL http://example.com/index.php/admin/


To change the page, you would call something like this:

http://example.com/index.php/admin/settings
http://example.com/index.php/admin/themes

etc...

which will load the views/settings.php and views/themes.php files respectively.


Lastly, you don't *need* to define a route (unless you want to) usually, that controller would be accessible without any routes defined via:

http://example.com/index.php/admin/view
http://example.com/index.php/admin/view/dashboard
http://example.com/index.php/admin/view/settings
http://example.com/index.php/admin/view/themes

since magic routing is available all the time.  

The "magic" routing is: http://example.com/[controller]/[method]/[$param1]/[$param2]... etc

Good luck and welcome to CodeIgniter!
Reply


Messages In This Thread
Adding admin area - by TamasD - 07-12-2018, 02:20 PM
RE: Adding admin area - by php_rocs - 07-12-2018, 03:15 PM
RE: Adding admin area - by TamasD - 07-12-2018, 09:12 PM
RE: Adding admin area - by salain - 07-12-2018, 10:53 PM
RE: Adding admin area - by enlivenapp - 07-13-2018, 07:12 AM
RE: Adding admin area - by TamasD - 07-13-2018, 08:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB