Example #1
0
 function out_singles($path, $template_path)
 {
     global $Sc;
     $file_count = 0;
     foreach ($this->Project->data['blocks'] as &$block) {
         $file_count++;
         ScStatus::update($block->getID());
         $options = $this->_getOptions($block, $project);
         // Template
         ob_start();
         include $template_path . '/single.php';
         $output = ob_get_clean();
         // Out
         file_put_contents($path . '/' . $block->getID() . '.html', $output);
     }
     ScStatus::updateDone("{$file_count} files written.");
 }
 function _doPostBuild()
 {
     /* Function: _doPostBuild()
      * Does post-build actions like modifying the homepage.
      * [Private, grouped under "Private functions"]
      */
     ScStatus::updateStart("Post build");
     // If there's no homepage,
     // Make one!
     if (is_null($this->data['home'])) {
         $this->register("Page: " . $this->getName());
     }
     // Finalize everything
     $block_count = 0;
     foreach ($this->data['blocks'] as &$block) {
         $block->preFinalize();
         if (++$block_count % 5 == 0) {
             ScStatus::update($block_count);
         }
     }
     // Remove blocks that are in the "exclude_tags" list
     while (TRUE) {
         foreach ($this->data['blocks'] as &$block) {
             if (0 < count(array_intersect_i((array) $block->_tags, (array) $this->options['exclude_tags']))) {
                 $block->unregister();
                 continue 2;
             }
         }
         break;
     }
     // [1] If there's a home, [2] each of the tree firstlevels
     // [3] that isn't the homepage [4] will be the child of the homepage.
     if (!is_null($this->data['home'])) {
         foreach ($this->data['tree'] as $i => &$block) {
             if ($block->getID() != 'index') {
                 $this->data['home']->registerChild($this->data['tree'][$i]);
             }
         }
     }
     // Finalize everything
     $block_count = 0;
     foreach ($this->data['blocks'] as &$block) {
         $block->finalize();
         if (++$block_count % 5 == 0) {
             ScStatus::update($block_count);
         }
     }
     ScStatus::updateDone("{$block_count} blocks.");
 }