views:

39

answers:

2

I'm building an app that has a section for consumers and businesses, and I want to separate the controllers folder appropriately, so it looks like this -

http://domain.com/users/signup/
http://domain.com/business/signup/

I have it working by creating a separate folder for each section in the "controllers" folder, but I want to know how to make an appropriate page when the user visits the http://domain.com/users/. It currently just loads the homepage. How can I fix this?

A: 

If I understand your question correct, you might be looking for URI Routing. I don't see why you would need folders for this. Simply just create the routes you need and make use of the index methods in the controllers for making the "homepage" for both users and business.

rkj
+1  A: 

You don't need to put them in separate folders for this to work.

File system/application/controllers/users.php:

<?php
class Users extends Controller {
    function index() {
        // this function will be called at http://domain.com/users
    }

    function signup() {
        // this function will be called at http://domain.com/users/signup
    }
}
?>

File system/application/controllers/business.php:

<?php
class Business extends Controller {
    function index() {
        // this function will be called at http://domain.com/business
    }

    function signup() {
        // this function will be called at http://domain.com/business/signup
    }
}
?>
Finbarr
Exactly what I was looking for. You just saved me a lot of time. Thanks!
Raphael Caixeta