Skip to content

Instantly share code, notes, and snippets.

@jawngee
Created July 15, 2009 09:09
Show Gist options
  • Save jawngee/147601 to your computer and use it in GitHub Desktop.
Save jawngee/147601 to your computer and use it in GitHub Desktop.
<?
class PostController extends Controller
{
public function index($post_id)
{
if (is_numeric($post_id))
{
$post=Model::Instance('blog.post',$post_id);
if ($post)
{
switch($post->type)
{
case 'image':
$this->view='post/image';
break;
case 'video':
$this->view='post/video';
break;
}
return array('post' => $post);
}
}
throw new NotFoundException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment