|
You are here: Home / Documentation / Workflow In Sitellite |
Workflow In SitelliteThe workflow service boxLet's create a box to perform the service of saving our contact data to a database table with the following schema: create table myapp_contact_submission ( id int not null auto_increment primary key, name char(72) not null, email char(72) not null, submitted_on datetime not null, message text not null, index (submitted_on, email, name) ); You can create this database table by pasting the above SQL into the SQL Shell in the DB Manager. The workflow service box could be as simple as this: inc/app/myapp/boxes/services/contact/submission/index.php <?php db_execute ( 'insert into myapp_contact_submission (id, name, email, submitted_on, message) values (null, ?, ?, now(), ?)', $parameters['data']['name'], $parameters['data']['email'], $parameters['data']['message'] ); ?> Now all we need to do is connect our box to the event by telling Sitellite about it. To do this, we need to add a service.php file to our new service box folder. This file will look like this: inc/app/myapp/boxes/services/contact/submission/service.php ; <?php /* name = myapp_contact_submission actions = contact title = Myapp Contact Submissions summary = Logs all contact form submissions to the database. ; */ ?> We also need to add one line to the bottom of our app's conf/config.ini.php file: workflow = yes Now, we should see our new service available in the Workflow Services in the Sitellite Control Panel. Check it off and hit Save to have your box be installed into the appropriate configuration file. In this case, that file would be inc/app/cms/conf/services/contact.php, which would then look something like this: ; <?php /* [service:myapp_contact_submission] name = Myapp Contact Submissions handler = "box:myapp/services/contact/submission" ; */ ?> If we execute our form and submit the test data, we should see the entry appear in our database table if we view it in the DB Manager. Page 1: Workflow in Sitellite is governe... |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |