Пример #1
0
 public function testLists()
 {
     // Default theme: test
     $pages = Page::lists('baseFileName');
     sort($pages);
     $this->assertEquals(["404", "a/a-page", "ajax-test", "authors", "b/b-page", "blog-archive", "blog-post", "code-namespaces", "code-namespaces-aliases", "component-custom-render", "component-partial", "component-partial-nesting", "component-partial-override", "cycle-test", "index", "no-component", "no-component-class", "no-layout", "no-partial", "optional-full-php-tags", "optional-short-php-tags", "throw-php", "with-component", "with-components", "with-content", "with-layout", "with-partials", "with-placeholder"], $pages);
     $layouts = Layout::lists('baseFileName');
     sort($layouts);
     $this->assertEquals(["a/a-layout", "ajax-test", "content", "cycle-test", "no-php", "partials", "php-parser-test", "placeholder", "sidebar"], $layouts);
 }
Пример #2
0
 public function index_onGenerateTemplate()
 {
     $templatePath = __DIR__ . '/../partials/default_page_content.htm';
     try {
         $pages = Page::lists('baseFileName', 'baseFileName');
         $pageName = post('page_name');
         $pageSettings = ['title' => post('page_title'), 'url' => post('page_url'), 'description' => post('page_description'), 'addressoTemplate' => []];
         $pageExists = array_key_exists($pageName, $pages);
         if (!$pageExists) {
             $this->createPageFromFile($templatePath, $pageName, $pageSettings, Theme::getEditTheme());
         }
     } catch (Exception $ex) {
         $this->handleError($ex);
     }
     return $this->index_onCreateForm();
 }