All pastes #335090 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-01 03:11 UTC
rendered paste body
class ShowPost extends FwController
{ 
  function execute() 
  { 
    global $IO; 
    $this->input('?','postId')->isInt(); // read variable postId and validate it's an integer
    $posts = Posts::getInstance(); // the model for the Posts db table
    if ($IO->postID !== null) { // if it's null means it's missing or invalid (not integer)
      $IO->post = $posts->getById($IO->postId); // put the post with that id into $IO variable post (will be shown by the template)
    }
  }
}