qAdmin is a special feature from qE to allow rapid ACP development. It has most features you may need to create a database oriented script for ACP.
There are so many configurable option for qAdmin, please read the information in /admin/qadmin_demo.php for more detailed explanation for each configuration.
qAdmin needs two (or three) arrays to work:
Data definition is an array of table fields definition, for example (from /admin/news.php):
// news_id :: int :: 10
$qadmin_def['news_id']['title'] = 'News Id';
$qadmin_def['news_id']['field'] = 'news_id';
$qadmin_def['news_id']['type'] = 'echo';
$qadmin_def['news_id']['value'] = 'sql';
// news_hit :: int :: 10
$qadmin_def['news_hit']['title'] = 'Hits';
$qadmin_def['news_hit']['field'] = 'news_hit';
$qadmin_def['news_hit']['type'] = 'echo';
$qadmin_def['news_hit']['value'] = 'sql';
It simply define each field used in the script according to the table used. The easiest way to build this very long array, is to use qadmin_build(table_name) function. For example:
The script will then create the data definition, which you can copy & paste it to your script, and tweak it if necessary.
This array contains all configuration values for qAdmin, including table used, primary_key name, template used, etc. For example (from /admin/news.php):
$qadmin_cfg['table'] = $db_prefix.'news'; // table name
$qadmin_cfg['primary_key'] = 'news_id'; // table's primary key
$qadmin_cfg['primary_val'] = 'dummy'; // primary key value
$qadmin_cfg['template'] = 'default'; // template to use
$qadmin_cfg['fastsearch'] = 'news'; // fast search ID
$qadmin_cfg['auto_recache'] = true; // rebuild cache
This array is optional. You can use this array to display additional information, eg, telling the user that he/she is now editing a News (and not a Page). For example (from /admin/news.php):
$qadmin_title['new'] = 'Add News';
$qadmin_title['update'] = 'Update News';
$qadmin_title['search'] = 'Search News';
$qadmin_title['list'] = 'News List';
You Are Done!
That's all! You are now ready to use qAdmin to manage your (ie) news. Simply call the qAdmin:
qadmin_manage ($qadmin_def, $qadmin_cfg, $qadmin_title);
And voila, the script is now ready to accept new item, or to update a saved item, or to search for certain item, or to list all saved items! No more coding! In fact, most of qE's ACP scripts are using qAdmin. That's why it looks cool & awesome.
Subscribe to our newsletter for the latest updates and exciting promotions!