Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create an "Admin Panel" for a project in cakephp ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 6.79k
    Comment on it

    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:

    1. . Create a basic web application in cakephp framework that have it's own database.
    2. . Download the pluging (link: https://github.com/plusglobal/BrowniePHP).
    3. . Now extract the downloaded package into the floder : app/Plugin/Brownie
    4. . Now add the Brownie panel component in the below mentioned file of your main application :
    5. project-folder/app/Controller/AppController.php

      class AppController extends Controller {
      
       var $components = array('Session', 'Brownie.BrwPanel');
      
      }
      

    6. . Now add the Brownie Behaviour in the below mentioned file of your main application :
    7. project-folder/app/Model/AppModel.php

      class AppModel extends Model {
      
       var $actsAs = array('Containable', 'Brownie.BrwPanel');
      
      }
      

    8. . 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.
    9. . For the execution of BrowniePHP, we add the following line in the bootstrap file of our main application.
    10. project-folder/app/Config/bootstrap.php

      CakePlugin::load('Brownie', array('bootstrap' => true, 'routes' => true));
      

    11. . Now we can login our admin panel using the following url:
    12. 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.

    13. . How to manage the column names in a table that we want to display/hide?
    14. 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')));
       }  
      

    15. . For documentation of BrowniePHP use the URL given below:
    16. http://browniephp.org/doc/
      

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: