/** * Returns the rendered HTML template. * * @return string the item rendered in HTML */ public function render() { // The formatted result has not been generated yet if (empty($this->result)) { // Generate the result using the default format for the chosen template $formats = ThumbsUp::config('default_formats'); $this->format($formats[$this->template]); } // Prepare item data for template $item = get_object_vars($this); unset($item['template'], $item['options']); // Load the chosen template $template = new ThumbsUp_Template(THUMBSUP_DOCROOT . 'templates/' . $this->template . '.php'); // Pass on all item data to the template $template->set('item', (object) $item)->set('template', $this->template)->set('options', (object) $this->options); // Render the template output return $template->render(); }