Skip to content
Permalink
Browse files

fallback to default theme .tpl files for incomplete themes

Enables writing themes without copying the full theme files from CleanFS-folder.

This enables to enhance Flyspray if a custom_*.css (colors, paddings, etc) or admin settings (footer areas etc. ) are not enough for customization, but keeps the redundancy of maintaining an extra theme low, because the main theme CleanFS is updated with each Flyspray release.
  • Loading branch information
peterdd committed Jan 23, 2017
1 parent 2dbbac0 commit baca7c441dbde9644b6cad73b93296a3977bf999
Showing with 12 additions and 9 deletions.
  1. +12 −9 includes/class.tpl.php
@@ -73,8 +73,8 @@ public function catch_end()
ob_end_clean();
}

public function display($_tpl, $_arg0 = null, $_arg1 = null)
{
public function display($_tpl, $_arg0 = null, $_arg1 = null)
{
// if only plain text
if (is_array($_tpl) && count($tpl)) {
echo $_tpl[0];
@@ -92,14 +92,17 @@ public function display($_tpl, $_arg0 = null, $_arg1 = null)

extract($this->_vars, EXTR_REFS|EXTR_SKIP);

if (is_readable(BASEDIR . '/themes/' . $this->_theme.'templates/'.$_tpl)) {
require BASEDIR . '/themes/' . $this->_theme.'templates/'.$_tpl;
} else {
// This is needed to catch times when there is no theme (for example setup pages)
require BASEDIR . "/templates/" . $_tpl;
}
if (is_readable(BASEDIR . '/themes/' . $this->_theme.'templates/'.$_tpl)) {
require BASEDIR . '/themes/' . $this->_theme.'templates/'.$_tpl;
} elseif (is_readable(BASEDIR . '/themes/CleanFS/templates/'.$_tpl)) {
# if a custom theme folder only contains a fraction of the .tpl files, use the template of the default full theme as fallback.
require BASEDIR . '/themes/CleanFS/templates/'.$_tpl;
} else {
# This is needed to catch times when there is no theme (for example setup pages, where BASEDIR is ../setup/ not ../)
require BASEDIR . "/templates/" . $_tpl;
}

} // }}}
} // }}}

public function render()
{

0 comments on commit baca7c4

Please sign in to comment.
You can’t perform that action at this time.