• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with controllers - New to CI

#1
[eluser]andriu[/eluser]
Hi everyone.

I'm new to CI and I'm trying to build my first application with it.
And I would be grateful for some help with controllers.

Tried to search trough guide and forums.

Problem: I'm trying to redirect to login.php if user is not logged on and it show up with 404.

files:
controllers/admin.php
controllers/admin/some_page.php
controllers/admin/login.php

url: example.com/admin
redirects if user not logged in:
redirect(admin/login);

but it shows up with a 404.


I would prefer to delete admin.php but I don't know how to load some_page and check if user is logged in.

So how do i set a default controller within a subfolder??


Any help would be appreciated.

#2
[eluser]andriu[/eluser]
Nevermind, Problem solved

Discovered if I delete admin.php and rename
some_page.php to welcome.php it works fine.

Didn't realize default controller goes for controller subfolder as well.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.