public function writeText(StreamInterface $stream, Website $website, $id, $data) { $title = htmlSpecialChars($data["title"]); $amount = (int) $data["amount"]; $commentLookup = new CommentRepository($website->getDatabase()); $latestComments = $commentLookup->getCommentsLatest($amount); $view = new CommentsSmallTemplate($website->getText(), $latestComments); $stream->write('<h2>' . $title . "</h2>\n"); $view->writeText($stream); }
public function init(Website $website, Request $request) { $oComments = new CommentRepository($website->getDatabase()); $this->comments = $oComments->getCommentsLatest(); $this->viewingUser = $website->getAuth()->getCurrentUser(); }