Welcome to the Canvas Lightweight Framework

This site is a fully-functional demonstration of an application built with the Canvas Lightweight PHP Framework. I developed the framework in conjuction with the SkyBlueCanvas Lightweight CMS. I also use this framework on many of the smaller projects I need to develop quickly at my full-time job for a telecom company.

This lightweight PHP framework has helped me reduce development time on web projects and improve maintainability by encouraging consistent coding standards for all projects and developers.


You can find information about the coding standards in the READ_ME file.

Adding files to your application

To create your first project with the Canvas MiniFramwork, open the /canvas/app/index.php file and add the following code:

$canvas->events(
    array(
      'event1',
      'event2',
      'event3'
    ), 
1);

In the example code above, the names 'event1', 'event2' and 'event3' are just fillers. You can name these events anything you like but you should adhere to file naming and URL satandards because these names will be used in both file names and URL strings.

This code will tell the Lightweight Framework what 'events' your app will be handling and that it should create the necessary handler and ui files for you.

The 1 in the argument list tells Lightweight Framework to create the necessary HTML, CSS, PHP and JS files for each 'event'.

Example:

'event1' will need:

/ui/html/event1.html
/ui/css/event1.css
/ui/js/event1.js
/app/inc/handler.event1.php
/app/inc/funcs.event1.php

Next, all you need to do is add your code to each of these files repsectively. So your page HTML will go in /ui/html/event1.html and your process code will go in /app/inc/handler.event1.php.

Removing Files from your app

Removing files from your application is just as easy as adding them. First, remove the event name from the Canvas->events call, then add the following code to /root/app/index.php:

$canvas->kill(array(
    'default',
    'personalize',
    'thanks'
));

The Canvas Lightweight Framework will automatically remove the files for you.

Example UI Class Features

$ui->event("a", "mouseover", 'alert($j(this).attr("href"));');

$ui->set('page.title', 'This is my page title');

$ui->hide("#footer");   // Uses CSS to hide the element

$ui->hide("#footer", 1) // uses jQuery to animate the hide

$ui->show("#footer");   // Uses CSS to hide the element

$ui->show("#footer", 1) // uses jQuery to animate the show

$ui->redirect('http://www.mydomain.com');

$ui->error("#username", "Username is required"); // Outlines the field in red

$ui->note("This is just an example of a note to display on the page");

Example Session Class Features

$Session->set('pageviews', $session->get('pageviews') + 1);

$Session->clear('pageviews');

$Session->destroy();

For more details on the Lightweight Framework operation, file naming and coding conventions, see the READ_ME.txt file.

All your mini-apps are belong to us.