Skip to content

Instantly share code, notes, and snippets.

@JosephLenton
Created June 10, 2012 02:19
Show Gist options
  • Save JosephLenton/2903598 to your computer and use it in GitHub Desktop.
Save JosephLenton/2903598 to your computer and use it in GitHub Desktop.
get blog post
<?
get( '/blog/show/{title}' )->
validate( function( $title, &$post ) { $post = $this->model->posts->get( $title ); } )->
action(
function( $post ) {
$this->view( 'blog/post', $post );
},
function( $title ) {
$this->view( '404', "Blog post not found " . h($title) );
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment