|
GettingStarted
Getting Started will guide you thru using this framework once it's installed.
Featured, Phase-Deploy Simple Framework use
Creating A Simple Application. First, Create an index.php which will accept the incomming requests. like so:
<?php
require '../lwmvc/lwmvc.class.php';
$fm = new lwmvc();
$fm->setControllerDir($_SERVER['DOCUMENT_ROOT'] . '/app/controllers');
$fm->setTemplateDir($_SERVER['DOCUMENT_ROOT'] . '/app/templates');
$fm->setDefaultController('home');
$fm->setFrameworkDir('../lwmvc');
$fm->setCaptureExternalFormPosts(true);
$fm->handleRequest();Let me break this down line by line: require '../lwmvc/lwmvc.class.php'; Add lwMVC class to your index.php. $fm = new lwmvc(); Create an instance of the framework for use in your index.php file. $fm->setControllerDir($_SERVER['DOCUMENT_ROOT'] . '/app/controllers'); $fm->setTemplateDir($_SERVER['DOCUMENT_ROOT'] . '/app/templates'); Set the Directories you will use to store your templates and controller classes. $fm->setDefaultController('home');Set's the default controller to sent requests to if there was no controller sent. $fm->setFrameworkDir('../lwmvc');Set's the directory where the framework is located relative to your application root. $fm->setCaptureExternalFormPosts(true); When set to true, it prevents form post vars from remote locations that have no yet visited this page and received an authentication token. $fm->handleRequest(); Runs the request and finishes out the functionality. |
► Sign in to add a comment