folder structure


I am new to Yii and I want to create the correspondint file structure.

I need frontent to be accessable via

and backand to be accessable via

I will use simple hardcoded admin username/password for administation for now.

What would be the best folder structure?

I have found the following

but I do not understand if it fits my needs.

As I have read in some forum topics this makes two different vhost links (for backend and frontend).

I actually do not need it. I need to have only one virtual host link that points to

I suggest you to create admin module. So you link will be index.php?r=admin/controller/action instead of index.php?r=controller/action.

Admin module


add sub-folder "admin" in /controllers and /views and put you controllers and view files into them.

If you need something simple I’d go with the second approach. For a more advanced usage I’d go with an admin module.

I’d use the approach from the link you provided for a large/huge project only.

Thank you.

I have quite simple project, so I like an approach with admin subfolders.

However, I have a question:

when do you choose to have admin subfolder and when do you use admin module?

Module usage description - I couldn’t describe better :)

In other words: if you need not only back-end CRUDs with views, but used in back-end only models and/or components and/or external libraries, then, of course, you’d better to use a separate admin module.

IMO, there’s not that big difference for a simple back-end between these approaches, and the choice often depends on whole application design and architect developer taste.

If you want to go for advance you should go with module or add sub-folder "admin" in /controllers and /views and put you controllers and view files into them…

I believe it’s better to use module, it’s more yii-way.