static function displayTemplate(array $vars = array()) { $template = Page::getPageTemplateVars(); $template = array_replace_recursive($template, $vars); echo Clap::getService('Template')->getNew(Page::getTemplate())->render($template); }
/** * Builds the form for adding or editing a page. * @param string $action * @param Page $page * @return Zend_Form */ protected function _getForm($action, $page) { $config = Zend_Registry::get('config'); $formConfig = array('action' => $action, 'elements' => array('id' => array('type' => 'hidden', 'options' => array('required' => false, 'value' => $page['id'])), 'title' => array('type' => 'text', 'options' => array('label' => 'Title', 'required' => true, 'value' => $page->title)), 'slug' => array('type' => 'text', 'options' => array('label' => 'Slug', 'required' => true, 'value' => $page->slug, 'filters' => array('slugify'), 'validators' => array('slugUnique'))), 'body' => array('type' => 'wysiwyg', 'options' => array('label' => 'Body', 'required' => true, 'value' => $page->body, 'attribs' => array('style' => 'width: 100%;'))), 'template' => array('type' => 'select', 'options' => array('label' => 'Template', 'required' => true, 'multiOptions' => $this->_fetchFiles($config->paths->templatePath), 'value' => $page->getTemplate(), 'description' => 'You can select a different template to structure the text.')), 'layout' => array('type' => 'select', 'options' => array('label' => 'Layout', 'required' => true, 'multiOptions' => $this->_fetchFiles($config->paths->layoutPath, false), 'value' => $page->getLayout(), 'description' => 'You can select a different layout to render the structured text in.')), 'homepage' => array('type' => 'checkbox', 'options' => array('label' => 'Is Homepage', 'required' => false, 'value' => (int) $page->homepage, 'checked' => (bool) $page->homepage ? 'checked' : '', 'description' => 'Check this box to make this page the default.')), 'submit' => array('type' => 'submit', 'options' => array('label' => 'Save', 'ignore' => true)))); $form = new Fizzy_Form(); $form->setOptions($formConfig); $form->template->addDecorator('Description'); $form->layout->addDecorator('Description'); return $form; }