Skip to content

Instantly share code, notes, and snippets.

@makeusabrew
Created October 6, 2011 09:55
Show Gist options
  • Save makeusabrew/1267007 to your computer and use it in GitHub Desktop.
Save makeusabrew/1267007 to your computer and use it in GitHub Desktop.
Jaoss - add article form controller / view refactoring
<?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());
}
}
{* 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'}
<input type="submit" value="Add Article" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment