diff --git a/cfg/conf.ini.sample b/cfg/conf.ini.sample index eec2bd32..1343df00 100644 --- a/cfg/conf.ini.sample +++ b/cfg/conf.ini.sample @@ -31,7 +31,7 @@ defaultformatter = "plaintext" ; size limit per paste or comment in bytes, defaults to 2 Mebibytes sizelimit = 2097152 -; template to include, default is "bootstrap" (tpl/bootstrap.html) +; template to include, default is "bootstrap" (tpl/bootstrap.php) template = "bootstrap" ; (optional) notice to display diff --git a/lib/View.php b/lib/View.php index 6ee8fa7b..d7ecaa21 100644 --- a/lib/View.php +++ b/lib/View.php @@ -52,7 +52,8 @@ class View */ public function draw($template) { - $path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $template . '.php'; + $file = substr($template, 0, 9) === 'bootstrap' ? 'bootstrap' : $template; + $path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $file . '.php'; if (!file_exists($path)) { throw new Exception('Template ' . $template . ' not found!', 80); } diff --git a/tpl/bootstrap-compact-page.php b/tpl/bootstrap-compact-page.php deleted file mode 100644 index 6290f3bf..00000000 --- a/tpl/bootstrap-compact-page.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/tst/ViewTest.php b/tst/ViewTest.php index 484ad468..7d3c727a 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -67,6 +67,25 @@ class ViewTest extends PHPUnit_Framework_TestCase ob_end_clean(); } } + // check bootstrap variants + $template = 'bootstrap-page'; + ob_start(); + $page->draw($template); + $this->_content[$template] = ob_get_contents(); + ob_end_clean(); + foreach (array('-dark', '-compact') as $suffix) { + $template = 'bootstrap' . $suffix; + ob_start(); + $page->draw($template); + $this->_content[$template] = ob_get_contents(); + ob_end_clean(); + + $template .= '-page'; + ob_start(); + $page->draw($template); + $this->_content[$template] = ob_get_contents(); + ob_end_clean(); + } } public function tearDown()