Controllers, administration login and some more..

Hi,

I am kinda new to Yii and I need your help to clarify a couple of things for me. Previously I was working with CodeIgniter so I guess I am not a total noob considering but I still do not understand a couple of things. When I was using codeigniter I used to have different controllers for every page so when I used an url like http://www.example.com/about it did call the about controller and the http://www.example.com/contact called the contact controller and so on. I saw that the Yii app that u generate has only one controller which manages every page. While I get that you have less controller files I just cannot see how you gona get those urls I provided before since, with yii its gona be http://www.example.com/site/about and so on. Another thing I was thinking about what if you have a lot of complex pages do you still create one controller only? Can anyone explain the logic to me so that I can see it more clearly?

Another issue for me is that I used to have a separate administraton backend where if u try to view a page without logging in it will give u an error message and redirect you to the login page saying that you need to login (as an admin) before you can view that page. Now I know it is not a hard job, but how do you actually do this with Yii’s user access control? Can anyone give me a simple and blunt tutorial for that?

I know these are beginner type questions but I always learned everything by myself so I am not quite familiar with all the concepts of professional development, thus I really need your help. Thank you in advance.

having one site controller for a couple of simple pages vs individual controller for each page, in fact, is just the way how you (developer) organize things. nothing to do with YII as a framework. that’s your own choice;

with one controller you can dump all your static-like pages into it, like about, contact, privacy policy etc.

if you don’t like to see site/about, site/contact, you can use URLManage in your config file to do the mapping.

so when you type /about it goes to /site/about etc.

user access control is done in controller through filter functions, suggest you grab the sample blog site comes with yii framework and walk through how it controls a login user to post.

Thank you for the answer I will surely check out the blog example.

I do know about UAC filters in controllers I just dont know how to handle the redirects/error messages on denial/acceptance.