Esempio n. 1
0
 function generate()
 {
     if (!file_exists($this->output)) {
         mkdir($this->output);
     }
     if (!is_dir($this->output)) {
         throw new \Exception("'" . $this->output . "' is not a directory");
     }
     // set up template locations
     PageRenderer::addTemplatesLocation(__DIR__ . "/../templates");
     foreach ($this->options['templates'] as $template) {
         PageRenderer::addTemplatesLocation($template);
     }
     PageRenderer::addStylesheet("default.css");
     // TODO delete all files within it?
     $this->generateFile("index", $this->database);
     foreach ($this->database->getNamespaces() as $namespace) {
         $this->generateFile("namespace", $namespace, array('namespace' => $namespace));
         foreach ($namespace->getClasses() as $class) {
             $this->generateFile("class", $class, array('namespace' => $namespace, 'class' => $class));
         }
         foreach ($namespace->getInterfaces() as $interface) {
             $this->generateFile("interface", $interface, array('namespace' => $namespace, 'interface' => $interface));
         }
     }
     // copy over CSS
     copy(__DIR__ . "/../templates/default.css", $this->output . "default.css");
 }
Esempio n. 2
0
<?php

require __DIR__ . "/../vendor/autoload.php";
require __DIR__ . "/functions.php";
// set up config
Openclerk\Config::merge(array("site_name" => "genealogy", "absolute_url" => is_localhost() ? "http://localhost/genealogy/" : "http://example.com/", "display_errors" => is_localhost()));
// set up routes
\Openclerk\Router::addRoutes(array(":page" => "pages/:page.php"));
// set up pages
\Pages\PageRenderer::addTemplatesLocation(__DIR__ . "/../site/templates");
\Pages\PageRenderer::addStylesheet(\Openclerk\Router::urlFor("css/default.css"));
\Pages\PageRenderer::addJavascript("https://code.jquery.com/jquery-2.1.1.min.js");
\Pages\PageRenderer::addJavascript(\Openclerk\Router::urlFor("js/default.js"));
require __DIR__ . "/tree.php";