We can use a plugin, that will help us to create an admin panel in a very short span of time.
For cakephp framework there is a plugin named as BrowniePHP.
Prerequisite:
One should know how to create web sites and web applications using cakephp framework.
Setting up the BrowniePHP:
- . Create a basic web application in cakephp framework that have it's own database.
- . Download the pluging (link: https://github.com/plusglobal/BrowniePHP).
- . Now extract the downloaded package into the floder : app/Plugin/Brownie
- . Now add the Brownie panel component in the below mentioned file of your main application :
project-folder/app/Controller/AppController.php
class AppController extends Controller {
var $components = array('Session', 'Brownie.BrwPanel');
}
- . Now add the Brownie Behaviour in the below mentioned file of your main application :
project-folder/app/Model/AppModel.php
class AppModel extends Model {
var $actsAs = array('Containable', 'Brownie.BrwPanel');
}
- . Now for creating the tables needed for BrowniePHP we execute the brownie.sql that will create 3 tables in your existing database for the main application. The tables will be name as brw_users, brw_files and brw_images. We get brownie.sql from the BrowniePHP packet.
- . For the execution of BrowniePHP, we add the following line in the bootstrap file of our main application.
project-folder/app/Config/bootstrap.php
CakePlugin::load('Brownie', array('bootstrap' => true, 'routes' => true));
- . Now we can login our admin panel using the following url:
http://www.your-domain.com/amdin
"Admin Panel " Login :
Use a username and password of your choice for the first time. These credentials will be saved in the table brw_users without any validations.
Note: username should be a valid email address.
- . How to manage the column names in a table that we want to display/hide?
Let say, we have a table users which consists of following fields:
'user_name', 'email', 'social_id', 'gender', 'suspend', 'state', 'city', 'user_image', 'user_name',
'social_id', 'modified', 'created'
Suppose we want to display specific column fields of the table users and we want to hide the following columns names:
'state', 'city', 'user_image', 'user_name', 'social_id', 'modified' , we simply write the following line in the User model, we write the following lines in our "User" class in the below mentioned path:
project-folder/app/Model/User.php
class User extends AppModel {
public $brwConfig = array(
'fields'=>array(
'hide' => array('state', 'city','user_image','user_name','social_id','modified')));
}
- . For documentation of BrowniePHP use the URL given below:
http://browniephp.org/doc/
0 Comment(s)