Knickers: Change your underwear!
Getting Started

We assume at this point that you've installed Knickers...

Short Version
cd /path/to/where/you/want/app
[KNICKERS_ROOT]/scripts/create_appskel.php [short app name]
Long Version

To create an application using Knickers, first decide on an application name, and then determine where it will reside. The application directory itself should not be web accessible, but some subdirectories will need to be.

Let's say we want to name our application "myapp" and we want it to reside in /home/yourname. We run the Knickers scaffolder to get us started:

cd /home/yourname
[KNICKERS_ROOT]/scripts/create_appskel.php myapp

This will create the "myapp" directory (which is now KNICKERS_APP_ROOT), as well as several required subdirectories and files. If you already have a database set up, it will assist you with configuring your Knickers project to use that as well.

Chances are (at least initially), you want to point your web server's Document Root at the "[KNICKERS_APP_ROOT]/common" directory, unless you are hosting multiple client systems (more than one client using the same code base). In that case, your Document Root should be the "[KNICKERS_APP_ROOT]/links" directory, and you need to create a symlink in that directory to the common directory for each client system (If you don't have a web server setup, checkout Setting Up A Web Server).

Your webserver must support forcing the "type" of a file; in Apache, this is done with the "ForceType" directive. The type for the controller file "page" must be set to php. For Apache, this can be done within a "Files" directive, usually within a "VirtualHost" directive, or within an htaccess file. The create_appskel.php script will create an htaccess file for you (NOTE: Your web server must have 'AllowOverride FileInfo' set for this to work!); but in case you need an example:

	DocumentRoot /path/to/your/app/common
	<Files page>
		ForceType application/x-httpd-php

-- OR --

(within [KNICKERS_APP_ROOT]/common/.htaccess)
<Files page>
	ForceType application/x-httpd-php

(A .htaccess file containing the above is created for you by the scaffolder.)

How do I create a simple !@#$@% web page??

At its simplest, a Knickers page requires two things:

1) A class that descends from the "Panel" or "Page" class
2) An html template

(There are *far* more things you can do with Knickers; this is a trivial example.)

Here's a "Hello World!" example.

First, create a file in the "[KNICKERS_APP_ROOT]/common/cls/Controller/" directory called "Panel_HelloWorld.class.php".

Its contents should look like this:
* My first Knickers page
*@author Your Name <>


class Panel_HelloWorld extends Panel
	var $baseTemplate = 'HelloWorld.tpl'; // the main template for this Panel.

	* This function provides the main logic for the page
	*@access public
	*@return void
	function run()
		// set a simple tag
		// ("og" is an "OutputGenerator"; it parses templates)
		$this->og->setTag('SUBJECT', 'World');

Next, create a file in the "common/tpl/html" directory called "HelloWorld.tpl".

Its contents should look like this:
Hello {SUBJECT}!

(No need for <html> tags at this point, as a default "outer" template provides them; it is created for you by the scaffolder. The template is located at [KNICKERS_APP_ROOT]/common/tpl/html/outer.tpl )

Now point your web browser at

Next step: A simple example page