public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $this->name = 'html'; $pm = new Pagemill($data); $skin = $data->parseVariables($this->getAttribute('skin')); $oldskin = null; if ($skin) { $oldskin = Typeframe_Skin::Current(); Typeframe_Skin::Set($skin); } else { $skin = Typeframe_Skin::Current(); } if (file_exists(TYPEF_DIR . '/skins/' . $skin . '/skin.html')) { $skinTree = $pm->parseFile(TYPEF_DIR . '/skins/' . $skin . '/skin.html'); } else { $skinTree = $pm->parseFile(TYPEF_DIR . '/skins/default/skin.html'); } $skinTree->process($data, $stream); if (!is_null($oldskin)) { Typeframe_Skin::Set($oldskin); } }
if (!file_exists($full_template)) { Typeframe::Redirect("Unable to find page template ({$template}).", $typef_app_dir, -1); return; } $skin = Typeframe_Skin::At(TYPEF_WEB_DIR . $page['uri']); $stylesheets = Typeframe_Skin::StylesheetsFor($template, TYPEF_WEB_DIR . $page['uri']); $pm->setVariable('stylesheets', $stylesheets); // load inserts and groups for template $inserts = Insertable::ElementsFrom($full_template, TYPEF_WEB_DIR . $page['uri']); $groups = Insertable::GroupsFrom($full_template, null, $skin); // get revision id, if any $revisionid = @$_REQUEST['revisionid']; // process form if ('POST' == $_SERVER['REQUEST_METHOD']) { if (!empty($_POST['cmd']) && $_POST['cmd'] == 'Preview') { Typeframe_Skin::Set(Typeframe_Skin::At(TYPEF_WEB_DIR . $page['uri'])); Typeframe::CurrentPage()->setPageTemplate('/content/' . $page['settings']['template']); return; } // build content array from post $content = Content::ProcessPost($inserts, $groups); // add/edit content //$content_page = new Content_Page($pageid, $revisionid); $content_page = Model_Content_Page::Get($pageid); if (!$content_page->exists()) { $content_page = Model_Content_Page::Create(); $content_page['pageid'] = $pageid; } $content_page['content'] = $content; //$content_page->set('content', json_encode($content)); $content_page->save();