Application

From Surebert wiki

Contents

Overview

The surebert framework is an MVC style framework for PHP which also takes advantages of the surebert javascript toolkit. It was developed by Paul Visco and is used by Roswell Park Cancer Institute for internal and external development.

A surebert framework application involves a specific layout for your application. Because all surebert applications have the same exact directory structure, it makes it really easy to move code from one app to another and to know where to look for code in your application. See Framework:SBF Deployment Guide for more information about deploying the framework.

Creating Your Application

The first step in developing a new surebert framework application is to check out a skeleton app from the svn repository.

Instructions here: Framework:starting a new application

Gateway Request Routing

The default request is represented by the Gateway::$request object. It is rendered as follows.

e.g. yoursite.com/foo

  • /public/foo/index.html or index.php if it exists
  • OR /controlers/FooController::index() if it exists and is @servable true
  • OR /controllers/IndexController::foo(); if it is @servable true
  • OR /views/foo/index.view if it exists
  • OR /controllers/IndexController::not_found();

e.g. yoursite.com/foo/bar/

  • /public/foo/bar/index.html or index.php if it exists
  • OR /models/Foo/method if it extends sb_Magic_Model and a method exists called action and is marked @servable
  • OR if /controlers/FooController::bar(); exists call that
  • OR if /views/foo/bar.view exists call that
  • OR if /controlers/FooController exists but servable bar() method does not exist and foo/bar.view does not exist FooController::not_found();
  • OR /controllers/IndexController::foo(); if it is @servable true
  • OR /controllers/IndexController::not_found();

There is no additional nesting. Any additional /anything after the first slash is assigned to the $request's args array e.g. /blog/read/5. See Framework:sb_Request for more details on the request's properties.

Additional Information

  • directory structure - An overview of what directories are in a framework application and what they are used for
  • Gateway - The "gateway" between the web directory root and the private controllers.
  • global configuration - Where to put global configuration information
  • Controllers - An overview of surebert controllers
  • views - An overview of surebert framework .view files
  • models - An overview of surebert framework models
  • filtering - Filtering input and output
  • command line - Using your application from the command line
  • sb_Classes - additional centrally stored framework classes in /var/www/sbf