Tutorial, Your first app
Your first application!
In this tutorial you will learn:
How files are organized in Tequila
How your code should be organized
How to make a complete CRUD (Create Read Update Delete) page
How to create a template
How to work with multiple languages
* Note: This tutorial DON"T use the fastest way to create the application using Tequila, rather it tries to help you get familiar with the framework
For this tutorial let's try the famous categories / recipe example
Pre-requisites
We assume you already download and configure a Tequila application, if you haven't you can do it following this page
Project description
Simple recipes application with recipes categories
Creating database
Run this script from your favorite mySql application
(phpMyAdmin or any other)
DROP TABLE IF EXISTS T_RECIPES;DROP TABLE IF EXISTS T_CATEGORIES;CREATE TABLE T_CATEGORIES ( I_IDCATEGORY int NOT NULL AUTO_INCREMENT, I_NAME varchar(100) NOT NULL DEFAULT '', PRIMARY KEY(I_IDCATEGORY)) engine=InnoDB;;CREATE TABLE T_RECIPES ( I_IDRECIPE int NOT NULL AUTO_INCREMENT, I_IDCATEGORY int NOT NULL, I_TITLE varchar(100) NOT NULL DEFAULT '', I_DESCRIPTION varchar(255) NULL, I_DATE date NULL, I_INSTRUCTIONS text NULL, CONSTRAINT fk_r_c foreign key (I_IDCATEGORY) references T_CATEGORIES(I_IDCATEGORY), PRIMARY KEY(I_IDRECIPE)) engine=InnoDB;
Hey what about the T_'s and I_'s
They are not required, we suggest as a good practice for multiple databases; When you work with a single database is easy to see your mistakes in field and table naming as the create instruction will fail when you run it. When you need to migrate your application to a new database you might discover name, date, status and many other words are reserved in one of them. So as a simple practice we name all fields I_ and all tables T_.
Your first page
We will need to create 2 pages for this application, categories and recipes,