"; $body .= sprintf("

%s

Published on: %s
", $this->title, date("Y-m-d", strtotime($this->date_posted))); // Display tags for($i = 0; $i < count($this->tags); $i++) { $tag = $this->tags[$i]; $body .= sprintf(" %s ", $tag["color"], $tag["name"]); } // Display publish date and end metadata div $body .= sprintf(" Last edited on: %s
", date("Y-m-d", strtotime($this->date_edited))); // Display hrule, article content and end the article $body .= sprintf("
%s
", $this->content); return $body; } /** * Display the comments for this post and their children. */ public function display_comments(){ $body = "
"; for($i = 0; $i < count($this->comments); $i++){ $body .= $this->comments[$i]->display_comment(); } return $body."
"; } /** * Constructor for the blogpost. * $blogpost_id GUID of the blogpost in the database. * $address Readable address of the blogpost. * $title Title of the blogpost. * $content Content of the blogpost article. * $date_posted Timestamp at publishing of article. * $date_edited Timestamp at whioch the article was last edited. * $tags Array of the tags this article has. * $comments Array of Blogpostcomment objects, * the comments of this article. */ public function __construct($blogpost_id, $address, $title, $content, $date_posted, $date_edited, $tags, $comments){ $this->blogpost_id = $blogpost_id; $this->address = $address; $this->title = $title; $this->content = $content; $this->date_posted = $date_posted; $this->date_edited = $date_edited; $this->tags = $tags; $this->comments = $comments; } } ?>