My favorites | Sign in
Project Home Wiki Issues Source
Search
for
GettingStarted  
Getting Started will guide you thru using this framework once it's installed.
Featured, Phase-Deploy
Updated Feb 4, 2010 by justin.a...@gmail.com

Simple Framework use

  • Create an index.php file in a web accessible location.

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
Powered by Google Project Hosting