Cuppa Documentation

Find information related with: installation, user interface, best practices, improve and extend de functionalities, front-end integration and more.
Configure tables

The major characteristic is set up and manage all the tables on your Database easy and fast.

In this article we will create and administrate 2 simple tables {categories, articles} to show you the process to administrate any table in your project.

To start, we will create 2 tables in the database, below are the MySQL scripts.

/* CATEGORIES*/
CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`enabled` int(11) DEFAULT '1',
`date` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 

/* ARTICLES */
CREATE TABLE `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`description` text,
`article` text,
`category_id` int(11) DEFAULT NULL,
`enabled` int(11) DEFAULT '1',
`date` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Now, we will to configure both tables with Cuppa CMS.


Categories table.

Click to Table Manager on the left menu, this section show a list of all table configured.

To add a new table, select the "categories" table on the top right select and click on "config" button.

  

The configuration panel, show us all available columns on the table, with different information to configure:

  • Label: Personalized label for each column.
  • Show in list: If is not selected, the column won't show in the list view.
  • Include in download: Cuppa CMS offer a button to export all information on a .csv file. If it field is not selected, the specific column will be exclude in the file.
  • Required: Set the field like required.
  • Primary key: Set the primary key, normally the primary key is the first column configured like: id, auto-incremental.
  • Configure field: You can configure the field with diverse predefined entry types or create your personal entry type.

        • Id: Field without configuration.
        • Text: Click on config field button to set the parameters of this field: email, password, number, etc.
        • Text Area: Click on config field button to set the parameters of this field.
        • Select: Click on config field button to set the parameters of this field.
        • Select List: Click on config field button to set the parameters of this field.
        • Check: Field without configuration.
        • Radio: Click on config field button to set the parameters of this field.
        • Date: Click on config field button to set the parameters of this field.
        • File: Click on config field button to set the parameters of this field.
        • Auto Complete: Click on config field button to set the parameters of this field.
        • Language Selector: Field without configuration.

  • Field Permissions: Set different permission by this field, to know more about permission read the article about permissions.

The table "categories" configuration should be: id:Id, name:Text, enabled:Select, date:Date.

Enabled field configuration: We have configured the enabled field like a select with 2 personal parameters (1,0) like data and (true, false) like labels. 

 
data (1) - label (true)
data (0) - label (false)

Save. The table "categories" is ready to administrate (insert, edit, delete, etc).

Now, we will add a quick access to administrate this table, adding a menu element on top menu clicking the right button "add menu item for admin this table" 

To end, write a personal title to the menu item and save.


Articles table.

Before to configure, articles table, will to insert some data into the "categories" table

Category 1, Category 2, Category 3, etc...

Click to Table Manager on the left menu, this section show a list of all table configured.
To add a new table, select the "articles"
table on the top right select and click on "config" button.

Remember configure all fields like you need and save.
On this case we will configure two new field {TextArea, Select}

The configuration of "categories" table should be: id:Id, title:Text, description:TextArea, article:TextArea, category_id:Select, enabled:Select, date:Date.

category_id field configuration: We have configured the category_id field like a select with a table info.

To end, we will add a quick access to administrate this table, adding a menu element on top menu clicking the right button "add menu item for admin this table".

It is all, you can start to add categories, articles and categorized the articles.