This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/models/articles.php */ | |
class Article extends Object { | |
// we don't any extended functionality just yet | |
} | |
class Articles extends Table { | |
protected $order_by = "`created` DESC"; // we want our newest articles first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; live.ini -> demo.ini -> build.ini | |
; we only override what we need to in here | |
[errors] | |
; we want debug level error messages on screen | |
verbose=true | |
[log] | |
level=debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/paths.php */ | |
PathManager::loadPaths( | |
array("/articles/add", "add_article") | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{* apps/news/views/add_article *} | |
<h1>Add an article</h1> | |
<p>Your story will be automatically published - so keep it clean!</p> | |
<form action="/articles/add" method="post"> | |
{include file='default/views/helpers/field.tpl' field='title'} | |
{include file='default/views/helpers/field.tpl' field='intro'} | |
{include file='default/views/helpers/field.tpl' field='content'} | |
{include file='default/views/helpers/field.tpl' field='author_email'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{* apps/news/views/add_article *} | |
<h1>Add an article</h1> | |
<p>Your story will be automatically published - so keep it clean!</p> | |
<form action="/articles/add" method="post"> | |
{include file='default/views/helpers/field.tpl' field='title' required=true} | |
{include file='default/views/helpers/field.tpl' field='intro' type='textarea'} | |
{include file='default/views/helpers/field.tpl' field='content' type='textarea' required=true} | |
{include file='default/views/helpers/field.tpl' field='author_email' type='email' required=true title='Author Email'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/controllers/news.php */ | |
class NewsController extends Controller { | |
public function add_article() { | |
// pass the columns array through to smarty | |
$this->assign("columns", Table::factory('Articles')->getColumns()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/controllers/news.php */ | |
class NewsController extends Controller { | |
public function add_article() { | |
// pass the columns array through to smarty | |
$this->assign("columns", Table::factory('Articles')->getColumns()); | |
if ($this->request->isPost()) { | |
// ah ha - handle user input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/paths.php */ | |
PathManager::loadPaths( | |
array("/articles/add", "add_article"), | |
array("/articles/(?P<id>\d+)", "view_article") | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* apps/news/controllers/news.php */ | |
class NewsController extends Controller { | |
public function add_article() { | |
$this->assign("columns", Table::factory('Articles')->getColumns()); | |
if ($this->request->isPost()) { | |
$article = Table::factory('Articles')->newObject(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// change this: | |
set_error_handler(function($errno, $errstr, $errfile, $errline) { | |
if (error_reporting() == 0) { | |
//Log::info("Surpressed error (".$errno.") caught in handler: [".$errstr."] in [".$errfile."] line [" | |
return; | |
} | |
throw new ErrorException($errstr, 0, $errno, $errfile, $errline); | |
}); |