Same Login With Different Front End

Dear All,

I have a large project divided into four parts like as follows

  1. classifieds,

  2. business directory

  3. online shopping

  4. discount coupon

For all the above four parts, I have to use same database with single login session, and each part has different navigation system (layout), as well as a common navigation to the whole site (common layout).

I need the application should run in the following way

  1. domainname/ - for common navigation

  2. domainname/classifieds/controller/action - for all classified related things

  3. domainname/directory/controller/action - for all business directory related things

  4. domainname/shop/controller/action - for all online shopping related things

  5. domainname/coupons/controller/action - for all coupons related things

  6. domainname/admin/controller/action - for back end management

I am a newbie to Yii, Is there any better way to achieve this?

You can change the layout-file for each controller (or even action).

Have a look here: http://www.yiiframework.com/forum/index.php/topic/17826-changing-layout-on-controller-action-views/

the way i achieve the thing you want is alot simplier than you thought. i want to put an level access control and i wanted to different layouts according to user level.

so i first started to implement this perfect article…

http://www.yiiframework.com/wiki/191/implementing-a-user-level-access-system/

Then i created more user levels as i like ( moderator, super moderator,admin ,noob user,user,dedicated user and so on…)

then i create simple functions like that one to learn what is the user level




function isAdmin(){

$user = $this->loadUser();

if ($user)

return $user->level==LevelLookUp::ADMIN;

return false;

}

function isModerator(){

        $user = $this->loadUser();

        if ($user)

            return $user->level==LevelLookUp::MODERATOR;

        return false;

    }

and then i add one more function to show different layouts to user…

i dont know what is your login return url but mine is index.php so i added that php code to my index…




if(Yii::app()->user->isAdmin())

{

 $this->renderPartial('//admin/_index', array('admin'=>$foo));

}

else if(Yii::app()->user->isModerator()){

 $this->redirect(array('site/moderator'));

}




i dont know if its the best way or not i m new in Yii too. But this solved my problem ;)

Gooc Luck