howto? setup front-end with users login and back-end with admin login?

Hi Everyone,

I am new here, aswell in Oop.

Tried the blog tutorial and works pretty fine.

I would like to use yii as a framework for my future webapps.

Figuring out mvc principal which is new for me.

Can somebody point me in the right direction? This is what i want to achieve;

A front-end website where users can register.

With several user-levels.

Based on their user-level they can access diffrent data from the database.

Then a admin section

www.website.com/admin

at this place te administrator or moderator (user levels again) can alter data in the diffrent tables.

Both (back-end & front-end) has diffrent lay-out skins.

I am also confused about the several authentication systems in yii.

Which one shall i use?

For the front-end for example, users can register but they need to be activated after for example buying a subscription and based on their subscription they will have a certain authentication level or after admin approval.

other question?

this forum (smf) is it intregratable in yii? ( using the same login credentials?)

thx in advance.

The following directory layout is one possible option:



index.php


admin.php


protected/


	config/


		main.php


		admin.php


	components/


	controllers/


		admin/


	models/


	views/


		admin/	


index.php is used as the entry script for your front-end, while admin.php is for back-end.

protected/ is the application directory for both front-end and back-end.

For the back-end, you need to configure admin.php so that:

protected/controllers/admin  is the base controller path for back-end

protected/views/admin is the base view path for back-end

For simple authorization, using access rules is sufficient. RBAC may be considered if you plan to do very sophisticated auth control (which I don't think is the case for your system.)

Yes, you can integrate forum accounts with your system. The integration occurs in UserIdentity where you should authenticate against the forum database.

thx qiang.

I opened my commandline and typed

www/yii/framework/yiic webapp www/skeleton


Create a Web application under '/var/www/skeleton'? [Yes|No] y


And voila, the whole structure is there… The basic structure.

Now i am gonna make some tweaks.(wish me luck)

Adding the admin section for my back-end.

In dreamweaver I'd setup a site called skeleton.

When adding the I mentioned that i didnt have access to the images folder.

so for now i chmod my skeleton folder to 777 to have access there…

chmod 777 -R www/skeleton

Now in dreamweaver i can access the files.

According to Qiang's tip for a folder structure I added some files and folders.

Which looks like this:

index.php

admin.php

protected/

config/


	main.php


	admin.php


components/


controllers/


	admin/


models/


views/


	admin/

I opened the index.php file and saved the file as admin.php, then i did some editing.

$config=dirname(__FILE__).'/protected/config/admin.php';

as you can see I pointed to the proper config file called admin.php and saved the file again.

Then I opened admin.php (which is a copy from main.php) in the protected/config folder.

Here i go…

return array(


	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',


	'name'=>'WEBADMIN',


I figured that i must change the basepath to point to my admin view section?

Under 'name' i made it WEBADMIN

But I dont know what to put as a basePath

Here I got stuck.

I moved on to finish the directory structure.

I created a admin folder in the controllers folder and copied the SiteController.php to that folder.

After opening this file I mentioned that this can stay this way for the moment.

All I see here are some basic actions.

Then I moved to the view section.

There i created again a admin folder and copied the folders /layouts and /site with the containing files to the admin folder.

the structure look like this

index.php

admin.php

protected/

config/


	main.php


	admin.php


components/


controllers/

                          SiteController.php

	     admin/

                                    SiteController.php

models/


views/


	admin/

                                layouts/

                                          main.php

                                    site/

                                          contact.php

                                          index.php

                                          login.php

                    layouts/

                              main.php

                          site/

                              contact.php

                              index.php

                              login.php

                      system/

Question 1. The basePath in admin.php in the config folder needs to be admin.

What is the proper code to puth there?

                             

Question 2. Does the view/admin folder need his own folder structure?

site/ and layout/ i think so because we want to create a totally diffrent layout here

Now when i hit localhost/skeleton/admin.php i see the default page with WEBADMIN in the title/logo section, but when i make some changes to view/admin/layouts/main.php i see that nothing changes.

you did wrong.

it has to be like for e.g.:

./config:

console.php

guest.php

member.php

./controllers:

guest/

member/

./controllers/guest:

MenuController.php

PageController.php

./controllers/member:

MemberController.php

ProfileController.php

./views:

guest/

layouts/

member/

system/

./views/guest:

menu/

page/

./views/guest/menu:

_form.php

admin.php

create.php

list.php

show.php

update.php

./views/guest/page:

show.php

./views/layouts:

guest.php

member.php

./views/member:

member/

./views/member/member:

login.php

register.php

in config files:

set different layouts

and in the main directory in the index.php and member.php

set different config files

$config=dirname(FILE).'/protected/config/member.php';

Cookbook has config/main.php under back-end. Here they are in the config folder as backend.php. This one logically is better - Which one to follow 

The cookbook tutorial stores configurations for front-end and back-end in different directories because each end may have several child configuration files (e.g. URL rules, parameters).