DataTables and Editor are powerful libraries, but before you can use them, they need to be installed on your system! This guide walks through how to download the Editor PHP package and set it up. The end result will be the ability to run all of the Editor examples on your own web-server, ready for yor to customise and experiment with as you need.
This installation is a simple four step process which the documentation below will guide you though.
To download the Editor PHP package, if you haven't already, open the Editor download page and select the Editor PHP package. If you already have a DataTables account the download will start immediately. if you don't have a DataTables account you will be asked to create one to start a trial.
When the download completes, unzip the file and upload the
Editor-1.7.2 directory to your web-server.
With Editor successfully uploaded to your server, we now need to load your database with the tables and data required for the Editor examples. The Editor PHP libraries work with a number of different databases, each of which requires its own SQL. The following links contain the SQL needed for each of the supported databases:
Select the appropriate file for your database and then run the SQL contained within on your database access portal (SQL Server Management Studio, CLI, phpMyAdmin or pgAdmin3 for example).
With the files and the SQL all in place, all that is left to do is instruct the Editor examples how to make a connection to the database. For this the only file you need to edit is
php/config.php in the Editor directory.
Edit this file in your preferred text editor (either directly on the server or edit it locally and then upload it to the server) by simply filling in the parameters of the
$sql_details array - this array provides the information that the Editor libraries need to make a connection to your database.
config.php file will look like this:
<?php if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables env. // Enable error reporting for debugging (remove for production) error_reporting(E_ALL); ini_set('display_errors', '1'); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Database user / pass */ $sql_details = array( "type" => "", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle" "user" => "", // User name "pass" => "", // Password "host" => "", // Database server "port" => "", // Database port (can be left empty for default) "db" => "", // Database name "dsn" => "" // PHP DSN extra information. Set as `charset=utf8` if you are using MySQL );
Note that on lines 3-5 we enable error reporting. This can be very useful for debugging problems when getting started with Editor, but you may wish to remove these two lines before deploying your web-site.
To now run the examples simply load
http://myWebSite.com/Editor-1.7.2/examples/ in your web-browser. The examples are now running on your own server!
Edit these files and look around at how things are done to get an idea of how you can implement your own Editor use cases on your own sites / app!
With the examples running, the next step is to start experimenting with the examples and understanding how the Editor PHP code operates so you can create your own editable tables.