“CRUD Gen” Documentation by “The-Di-Lab”


“CRUD Gen”

Created: 09 Jan 2010

By: The-Di-Lab

Email: thedilab@gmail.com

Social:

Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to contact me via my email. Please also follow my twitter account to get future updates of this script. Thank you very much!


Table of Contents

  1. Installation Guide
  2. Basic Usage
  3. Advanced Usage
    1. Customize column title name
    2. Style column th tag
    3. Disable sorting
    4. Column customization summary
    5. Diable CRUD operations
    6. Set overall table width
    7. Modify JQuery UI Theme
    8. Change primary key
    9. Hide column
    10. Enable ajax live search
  4. Sources and Credits

A)Installation Guide

  1. Upload whole "crud" folder to your domain directory.
  2. Open file "crud/boot.php", and give your specific value of "URL_ROOT". "URL_ROOT" is the absolute url path to the parent of "crud" folder. Don't touch the "ROOT".
  3. Open file "crud/config/setting.php" and enter value for database information. This setting should be very straightforward.
  4. This is all for installation, read sections below to setup your own data grid. Please note sample in this manual is using database table "crud_sample" as follow , you can create this table if you wish to test the sample while you are reading this manual.
    CREATE TABLE IF NOT EXISTS `crud_sample` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(250) NOT NULL,
      `email` varchar(250) NOT NULL,
      `is_admin` tinyint(1) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
    	  


B) Basic usage


  1. Include GridObject at the begining of the file where you want to show data grid table.
    This has to be located at the begining of the file, even before any html tags.
     <?php
    include 'crud/grid_object.php';
  2. Create an instance of GridObject.
    $gridObject = new GridObject();
  3. Set the database table which you want to show.
    $gridObject->setDbTable('crud_sample');
  4. Set number of records per page.
    $gridObject->setPerPage(5);
    		?>
  5. Include required css and javascript files in the header of html.
    <link type="text/css" rel="stylesheet"
    	href="crud/webroot/css/jquery-ui-1.8.7.custom.css" />
    <script type="text/javascript" 
    	src="crud/webroot/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript"
    	src="crud/webroot/js/jquery-ui-1.8.7.custom.min.js"></script>
    <script type="text/javascript"
    	src="crud/webroot/js/crud.js"></script>	
    <link type="text/css" rel="stylesheet"
    	 href="crud/webroot/css/crud.css" />
  6. Render data grid table inside your html body section.
    <div style="width: 100%; margin:auto; text-align: center;">
    	<?php $gridObject->render(); ?>
    </div>
  7. Below is the final file looks like, and you are supposed to see a data grid.
    <?php
    include 'crud/grid_object.php';
    $gridObject = new GridObject();
    $gridObject->setDbTable('crud_sample');
    $gridObject->setPerPage(5);
    ?>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link type="text/css" rel="stylesheet"
    	href="crud/webroot/css/jquery-ui-1.8.7.custom.css" />
    <script type="text/javascript" 
    	src="crud/webroot/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript"
    	src="crud/webroot/js/jquery-ui-1.8.7.custom.min.js"></script>
    <script type="text/javascript"
    	src="crud/webroot/js/crud.js"></script>	
    <link type="text/css" rel="stylesheet"
    	 href="crud/webroot/css/crud.css" />
    </head>
    
    <body>
    
    <div style="width: 100%; margin:auto; text-align: center;">
    	<?php $gridObject->render(); ?>
    </div>
    
    </body>
    </html>
    		


C) Advanced Usage


D) Sources and Credits


Once again, thank you so much for purchasing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script. No guarantees, but I'll do my best to assist. And do not forget to follow my twitter to get future updates.

The-Di-Lab

Go To Table of Contents