I have choosen module based separation for admin & public pages. I have created module for admin to do all CRUD.
Now, How can I handle for public? Like some functions to be displayed for public from admin CRUD? When I try to access public … it shows "admin" as the path name?
How can I hide this ? Do i need to create separate controllers/models for public in the "protected" folder?
=> First you want to create the default layout on protected/view folder
1)view/layout/main.php
2)view/index/index.php
=> create the default controller protected/controller/IndexController.php
so when site is running you want to call a layout on protectd/view/layouts/main.php
after user login on frontend you want to call layout on every module (frontend module laayouts/view/main.php)
=> you want to create all model on protected/models folder not in separate
=> Create the controller on separate and default controller is IndexController on front end module. and defult action is Index so every controller call a default action is Index action. and in Admin module you can set a defult action is Admin.
=> so On everu module you can set the default view on index on defult file is view/index/index.php
Then after you want to create the CoreContrller on module/components folder and set the defaut layout.
And finally you want to set the url structure on confing/main.php file
'urlManager' => array(
'urlFormat' => 'path',
//'showScriptName'=>false,
'rules' => array(
//set a admin url
'admin/' => 'admin/index/index',
'admin/login' => 'admin/index/login',
'admin/logout' => 'admin/index/logout',
'admin/<controller:\w+>/<action:\w+>' => 'admin/<controller>/<action>',
// set a fontend url
'user/' =>'user/index/index',
'user/login' =>'user/index/login',
'user/logout' =>'user/index/logout',
'user/<controller:\w+>/<action:\w+>'=>'user/<controller>/<action>',
//set a controller and action
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
create the default layout defind on componets folder
class AdminCoreController extends GxController
{
public $layout = 'admin';
public $accessRule = '';
public $userType = 'admin';
public $defaultAction = 'admin';
//some other function
}
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class FrontCoreController extends GxController
{
public $layout='main';
public function init()
{
parent::init();
}
}
so in admin module call a defult layout is admin.php and front end module call a defult layout is main.php.
The layout part is ok, for admin and public… but how can I show some function like …
There is CRUD operations for Manage Priests (Add/edit/delete/view more) … but for public , i want to display customized priests details with only view more? how to achive this ?
like if i want to create the model using gii so all model are generated on protected/models
and more important if you want to create the CRUD you want set the module path on creation time see this image
4707
in this image you can see the path
modules/admin/controllers/BannerManagementController.php so it;s creation on admin module folder and create the conterller and views file on admin module.
Yes is it correct for public view you can create the modles,controller and view on protected folder and particaular user view menans user login then call on frontend controller and views.
But make sure all models are in your modle folder not in seprate folder.