Moved installed to github Wiki, added new sample site (dubbed launchpad)

This commit is contained in:
Josh Sherman 2010-10-14 22:06:45 -04:00
parent 3fb1e8d3d0
commit a81f3c90ed
9 changed files with 178 additions and 26 deletions

26
INSTALL
View file

@ -1,26 +0,0 @@
______ _____ _____ _ __ _ _____ _____
| ___ \_ _/ __ \| | / /| | | ___/ ___|
| |_/ / | | | / \/| |/ / | | | |__ \ `--.
| __/ | | | | | \ | | | __| `--. \
| | _| |_| \__/\| |\ \| |____| |___/\__/ /
\_| \___/ \____/\_| \_/\_____/\____/\____/
PHP Interface Collection of Killer Libraries to Enhance Stuff
===========================================================================
Installation Guide
------------------
1. Extract PICKLES source code to the location of your choice. I usually
put it in /usr/share/pickles
2. Add PICKLES to your include path. This can be accomplished a number of
ways, my preference being adding it to the VirtualHost entry of my
Apache config and restart Apache:
php_value include_path .:/usr/share/pickles
3. Peep the sample-site directory, this contains a working site that should be
fairly easy to get up and running.
4. If all else fails, get in touch!

19
launchpad/apache.conf Normal file
View file

@ -0,0 +1,19 @@
# Sample Apache Virtual Host Entry
#
# If you'd rather not do it this way, the aliases can either be omitted
# entirely (at the loss of utilizing shared PICKLES static content) or it can
# be alternately accomplished via symlinks within your site's document root.
#
# As for the PHP include_path (which is very mandatory) you could set it
# directly in the php.ini file, or simply set the include_path with ini_set()
# at the top of index.php (already done in the sample index.php)
#
<VirtualHost *>
ServerName yoursite.com
ServerAdmin your@email.com
DocumentRoot /path/to/your/site/public
# Alias /pickles/css /path/to/pickles/css
# Alias /pickles/js /path/to/pickles/js
# Alias /pickles/images /path/to/pickles/images
# php_value include_path .:/path/to/pickles
</VirtualHost>

66
launchpad/config.php Normal file
View file

@ -0,0 +1,66 @@
<?php
$config = array(
// Define your envrionments, name => hostname or IP
'environments' => array(
'local' => '127.0.0.1',
'staging' => 'dev.mysite.com',
'production' => 'www.mysite.com',
),
// PHP configuration options
'php' => array(
'display_error' => true,
'error_reporting' => -1,
'date.timezone' => 'America/New_York',
),
// PICKLES configuration options
'pickles' => array(
// Disable with a "site down" message
'disabled' => false,
// Use sessions
'session' => true,
// Name of the parent template
'template' => 'index',
// Name of the default module
'module' => 'home',
// Name of the module to serve on 404 errors
'404' => 404,
// Internal class overides
'classes' => array('Form' => 'CustomForm'),
// Default datasource
'datasource' => 'mysql',
// Whether or not you want to use the profiler
'profiler' => array(
'local' => true,
'staging' => false,
'production' => false,
),
),
// Datasources, keys are what's referenced in your models
'datasources' => array(
'mysql' => array(
'type' => 'MySQL',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'test'
),
),
// Anything can be defined
'stuff' => array(
'foo' => 'bar',
'spam' => 'eggs',
// and can be broken out by environment
'bacon' => array(
'local' => true,
'staging' => true,
'production' => false
)
)
);
?>

View file

@ -0,0 +1,13 @@
<?php
/**
* Same Model
*/
class SampleModel extends Model
{
protected $datasource = 'mysql'; // Name of the datasource in our config
protected $table = 'test'; // Table to interact with from this model
protected $order_by = 'posted_at DESC'; // Columns to order by
}
?>

View file

@ -0,0 +1,19 @@
<?php
class home extends Module
{
public function __default()
{
// This is where your business logic lives
// You can create model objects like $model = new SampleModel();
// You can talk to the default database via $this->db
// You could even do nothing and delete this file
// If you have data you want to get from here to the template, just return array('my' => 'data');
}
}
?>

View file

@ -0,0 +1,28 @@
# Sets up ETags
FileETag MTime Size
# Prevent session IDs from appearing
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0
# Sets up the mod_rewrite engine
RewriteEngine on
RewriteBase /
# Strips the trailing slash
RewriteRule ^(.+)/$ $1 [R]
# Makes sure to skip rewriting actual files and directories
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]
# One rewrite to rule them all
RewriteRule ^(.+)$ index.php?request=$1 [NC,QSA]
# Blocks access to .htaccess
<Files .htaccess>
order allow,deny
deny from all
</Files>

View file

@ -0,0 +1,8 @@
<?php
ini_set('include_path', ini_get('include_path') . ':/path/to/pickles');
require_once 'pickles.php';
new Controller();
?>

View file

@ -0,0 +1,11 @@
<?php
// I'm the child template
// I can be loaded up with markup
// I can be loaded up with PHP
// Your call really
?>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Sample PICKLES Site</title>
</head>
<body>
<h1>PICKLES Sample Site</h1>
<h2>Super simple example of PICKLES in action</h2>
<?php
// Loads the module's template
require_once $template;
?>
</body>
</html>