Exemplo n.º 1
0
 public function render()
 {
     $path = sprintf(self::FILE_PATH_MASK, $this->dataPath);
     if (!file_exists($path)) {
         return;
     }
     $content = file_get_contents($path);
     $data = $this->pageProcessor->process($content);
     echo $data['content'];
 }
 /**
  * @param string
  */
 public function renderSitemap($type = 'html')
 {
     $this->template->addons = $this->addons->findAll();
     $this->template->vendors = $this->addons->findVendors();
     $this->template->categories = $this->tags->findMainTags();
     $pages = array();
     foreach (Finder::findFiles('*.texy')->from($this->pagesDataPath) as $file) {
         /** @var \SplFileInfo $file */
         $slug = Strings::substring($file->getRealPath(), Strings::length($this->pagesDataPath) + 1, -5);
         $data = $this->pageProcessor->process(file_get_contents($file->getRealPath()));
         $createdAt = new \DateTime();
         $createdAt->setTimestamp($file->getMTime());
         $pages[] = (object) array('slug' => $slug, 'name' => $data['title'], 'createdAt' => $createdAt);
     }
     $this->template->pages = $pages;
     if ($type == 'xml') {
         $this->setView('sitemap.xml');
     }
 }