Quick intro to Simplicity

Here are some screen shots to give you a taster for the admin console...

This is the 'home tab' of the admin console. Here you can see a quick into to simplicity and a dynamic, real time usage monitor, this gives you the current page views / sec across the site.

This is the 'Registry' of the simplicity application. This is an XML backed cascading hierarchical configuration used you use to hold all configuration for your site. But this is not limited to single, key/value types on information, you can for example store the navigational structure of your application within the registry, so you could have a container called home, and within there a container called children, and in there keys for the children etc. etc. This can be accessed in code as follows:

<?
/*
This code refers to the following tree:

navigation
   home
      info -> 'The info page'
      contact -> 'The contact page'     
*/

// Here we use the shortcut class to Simplicity_Registry: SRG
$nav = SRG::get('navigation'); // returns the entire navigation tree as an multidimensional array.
$nav = SRG::get('navigation.home'); // returns just the home container as an associative array.
$nav = SRG::get('navigation.home.info'); // here we return the value of the info key, as a string.
?>


This shows the context menus of the Registry tree, showing how you can add keys and containers to the registry.

This is the popup for adding a new root level item to the registry.

This shows the Application Structure section of the application, this is used to display all the current controllers and their methods, currently it is read only, but here you will be able to assign routes (custom URIs) to methods, and even create controllers from scratch directly within the interface.

This shows the data modeling tab of the console. This allows you to create connections to a variety of different data sources, including all RDBMS' supported by php PDOs, CSV and TSV files and raw PHP arrays, with support on the horizon for RSS feeds and more. Once created you can create Models associated with the connections, you do this by creating the model using the context menu, then adding column definitions, each column is a container and contains a variety of properties. Internally all of this is stored in the Registry, showing just how flexible it can be. When a model is defined it can be accessed in the code is a variety of ways:

<?
// Again here we are using the shortcut class for Simplicity_Data : SDA

//Request a specific model directly by id
$user = SDA::getModel('simplicity.users',1);

print $user->name; //outputs the value of the 'name' field.

//Request a group of models using MQL - this will request all the users.
$users = SDA::query('select simplicity.users');

foreach ($users as $user) {
        print $user->name.'</br>'; // outputs a list of all users
}

//Filter the results with where and limit
// users with names starting with J.
$users = SDA::query('select simplicity.users where name like "j%"'); 

// the first 10 users
$users = SDA::query('select simplicity.users limit 10'); 

// the next ten users, (offset by 10)
$users = SDA::query('select simplicity.users limit 10,10'); 

//Ordering
// show all users sort by name
$users = SDA::query('select simplicity.users order by name'); 

// show all users sort by kudos in reverse order.
$users = SDA::query('select simplicity.users order by kudos desc'); 

?>

Attachments