diff options
author | Filipp Lepalaan <filipp@mekanisti.fi> | 2009-10-30 23:38:03 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mekanisti.fi> | 2009-10-30 23:38:03 +0200 |
commit | efbacb9717eb28209c0362c84b293653915fb453 (patch) | |
tree | 0e3eb884dba9546c1845b3ce4ad9481fb4141d9d | |
parent | beadd930059012ddc6d055c09932227993305604 (diff) | |
download | main-efbacb9717eb28209c0362c84b293653915fb453.tar.gz main-efbacb9717eb28209c0362c84b293653915fb453.tar.bz2 main-efbacb9717eb28209c0362c84b293653915fb453.zip |
Fixes, updated readme
-rw-r--r-- | App.php | 11 | ||||
-rw-r--r-- | Controller.php | 6 | ||||
-rw-r--r-- | README | 17 |
3 files changed, 30 insertions, 4 deletions
@@ -151,8 +151,14 @@ class App */ static function error_handler($errno, $errstr, $errfile, $errline) { - $str = sprintf("%s\t%s\t%s\t%s\n", date("d.m H:i:s"), basename($errfile), $errline, $errstr); + $str = sprintf( + "%s\t%s\t%s\t%s\n", + date("d.m H:i:s"), + basename($errfile), $errline, $errstr + ); + self::log($str); + } /** @@ -257,7 +263,8 @@ class App public function js($string) { - return '<script type="text/javascript" charset="utf-8"> + header("Content-Type: text/javascript"); + print '<script type="text/javascript" charset="utf-8"> ' . $string . ' </script>'; } diff --git a/Controller.php b/Controller.php index 22dccc6..43b0efe 100644 --- a/Controller.php +++ b/Controller.php @@ -19,11 +19,14 @@ class Controller const TableName = ""; const TableSelect = ""; - function __construct() + function __construct($id = null) { // Child classes should always have the same name as their tables $this->table = strtolower(get_class($this)); $this->result = null; + if ($id) { + return $this->get($id); + } return $this; } @@ -254,6 +257,7 @@ class Controller } list($key, $value) = each($where); + $data = array(":{$key}" => $value); $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key}"; @@ -4,6 +4,7 @@ MAIN - the simple PHP framework site: public (this is the DocRoot for your site) + .htaccess (see .htaccess) index.php system (put all system support files in here) lib @@ -25,7 +26,7 @@ A typical index.php using MAIN would look like this: . "{$sysdir}/lib" . PATH_SEPARATOR . "{$sysdir}/conf" . PATH_SEPARATOR . "{$sysdir}/classes" . PATH_SEPARATOR - ); + ); require_once "main/app.php"; require_once "main/controller.php"; @@ -35,3 +36,17 @@ A typical index.php using MAIN would look like this: App::init(); ?> + +## .htaccess ## + +Main uses and is developed on using Apache httpd's mod_rewrite module. The .htaccess file in your web app's +public root folder should look something like this: + +<IfModule mod_rewrite.c> + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} -s [OR] + RewriteCond %{REQUEST_FILENAME} -l [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ index.php [NC,L] +</IfModule> |