This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
junior /
| name | age | message | |
|---|---|---|---|
| |
README.markdown | ||
| |
lib/ | ||
| |
public/ | Mon Nov 02 14:40:08 -0800 2009 | |
| |
views/ |
README.markdown
Junior - A really small PHP framework
Junior is a really small PHP framework inspired by Sinatra. It consists of two PHP files (working on making it one), two directories and a .htaccess file
It supports friendly URLs using regular expressions, and uses a single layout file, rather than the more common header and footer include setup
Setup
- git clone git://github.com/madpilot/junior.git new_app
- Create an app.php file in the new_app root path
- Point apache at the public directory in the new_app directory
- Put your stylesheets and javascripts in the public directory (keep it clean, make sub-directories!)
Example
<?php
require_once('lib/junior.php');
function route($request)
{
global $vars, $layout;
if(preg_match("/^$/", $request))
{
$layout = 'views/index_layout.php';
include('views/index.php');
}
elseif(preg_match("/^about$/", $request))
{
include('views/about.php');
}
elseif(preg_match("^/news/(\d+)$", $request, $m))
{
$id = $m[1];
include('views/news.php');
}
else
{
show_404();
}
}
run();
?>
Configuration Options
$layout - This sets the master layout for the request. Set it to false to not render a layout. Include the variable: $content somewhere in the layout and it will be replaced by the content of the rendered view
$vars - Because of PHP variable scoping, you can use this variable to set "global" variables for the layout file. We suggest a associative array








