Unnamed
public text v1 · immutableclass 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)
}
}
}