Cuppa Documentation

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


PHP framework have different methods to help you to integrate the Administrator characteristics like: load menus, get quick access to the Database, load and use language files, access to the configuration values, etc.

This section show the form to load PHP framework in your project and get a close integration with you Back-End.


Load the framework.

require_once "administrator/classes/Cuppa.php";
$cuppa = Cuppa::getInstance();

That is all, now we can access to all functionalities. Below, we will show some examples of it.

Load a language file and use it.

$lang_data = $cuppa->language->load("web");
echo $lang_data->title     // this print the value of "title" label in the language specify
echo $cuppa->language->getValue('label with spaces') // this method  use different form to get the value

Get a language reference.

current_lang = $cuppa->language->current();

Change the language reference.

$cuppa->language->set('es', true) // params: $language, $forced

Load menu data.

$menu = $cuppa->menu->get('web');   // return the menu with the web name like a array data
$menu = $cuppa->menu->getList('web'); // return the menu like a
  • string tag

Load menu item data.

$info = $cuppa->menu->getInfo('web', 'id or alias'); // return all info about the item

Methods to Database.

$cuppa->dataBase->getList($table); // return all the info in the table
$cuppa->dataBase->getRow($table, $condition) // return the info with the specific condition

$data = new stdClass();
$data->name = " 'name' "; // remember, string values should be between ' '
$data->age = 18;
$data->date = "NOW()"; // this string put the current date in a field with the type date
$cuppa->dataBase->insert($table, $data); // return 1 or 0 

Access to the Cofiguration.php

$cuppa->configuration->table_prefix; // get the table prefix
$cuppa->configuration->allowed_extensions; // get the list of allowed_extensions
$cuppa->configuration->db; // get the Database name
$cuppa->configuration->user; // get the Database user
$cuppa->configuration->host; // get the Database host

To discover more methods, we invite you to see each reference.