Welcome Guest, Not a member yet? Register   Sign In
Controller coding style question
#1

[eluser]Kitsched[/eluser]
Hello,

I have rewritten the A3M authentication system into something more "drop in" friendly as opposed to how the original system was distributed as a full CI install. Plus I have removed the bloat (images, db tables) which were added to A3M probably to support future feature. My code is live on GitHub: https://github.com/kitsched/A5M - it works, but it's work in progress ATM.

My controllers directory currently looks something like:

account_linked.php
account_password.php
[...]
connect_create.php
connect_facebook.php
[...]
sign_in.php
sign_out.php
sign_up.php

And each of these controllers (except sign_up.php) has a constructor and one method - index.

My question is if it wouldn't be better to move everything into one controller (account.php) or at least under one directory (application/controllers/account/).

As it stands now it looks way too spread out.
#2

[eluser]gRoberts[/eluser]
Your treating controllers as if they were actions.

Having an account controller would be better. Then it'd be account/linked, account/password, account/sign_in, account/sign_out, account/sign_up etc.

hth
#3

[eluser]Kitsched[/eluser]
Thanks for your input.

The problem that might arise when moving everything under one file would be that if users start integrating the system they will surely start customizing the methods to better suit their needs -> drop in upgrades wouldn't be possible. However, now that I think of it, the exact same stands for files spread around.

I'll wait for a couple more "votes" before I decide what to do.
#4

[eluser]osci[/eluser]
I believe if you want it to be more of a drop in it should be a library.
#5

[eluser]Kitsched[/eluser]
[quote author="osci" date="1309533117"]I believe if you want it to be more of a drop in it should be a library.[/quote]
Have a look, it is more than a library. It actually contains several libraries...

It handles sign up, sign in either via "vanilla" on site login or via third party providers such as Facebook, Twitter, Google, etc. Also profile administration, password change, forgot password functionality...




Theme © iAndrew 2016 - Forum software by © MyBB