public function renderTemplate() { $templater = NeechyTemplater::load(); $templater->page = 'NeechyPage'; $templater->set('content', '<h1>Test</h1>'); return $templater->render(); }
protected function respond($content, $status = 200) { # No AJAX response $templater = NeechyTemplater::load(); $templater->page = $this->page; $templater->set('content', $content); $body = $templater->render(); return new NeechyResponse($body, $status); }
protected function respond($content, $status = 200) { if ($this->request->format == 'ajax') { $body = $content; } else { # Render web page $templater = NeechyTemplater::load(); $templater->page = $this->page; $templater->set('content', $content); $body = $templater->render(); } return new NeechyResponse($body, $status); }
public static function create_on_install() { $pages_created = array(); $pages_dir = NeechyPath::join(NEECHY_APP_PATH, 'templates/core_pages'); $templater = NeechyTemplater::load(); foreach (self::$core_pages as $name) { $basename = sprintf('%s.md.php', $name); $path = NeechyPath::join($pages_dir, $basename); $page_body = $templater->render_partial_by_path($path); $page = Page::find_by_title($name); $page->set('body', $page_body); $page->set('editor', NEECHY_USER); $page->save(); $pages_created[] = $page; } return $pages_created; }
public function editor_link() { if (!$this->editor) { return 'N/A'; } else { $t = NeechyTemplater::load(); $editor_name = $this->editor->field('name'); return $t->neechy_link($editor_name); } }