aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/extend_for_templates.php52
-rw-r--r--include/template.class.php29
-rw-r--r--plugins/LocalFilesEditor/admin.php8
-rw-r--r--template/yoga/menubar.tpl2
4 files changed, 66 insertions, 25 deletions
diff --git a/admin/extend_for_templates.php b/admin/extend_for_templates.php
index 294d600af..30b21f277 100644
--- a/admin/extend_for_templates.php
+++ b/admin/extend_for_templates.php
@@ -73,29 +73,35 @@ $relevant_parameters = array_merge($relevant_parameters, $permalinks);
/* Link all supported templates to their respective handle */
$eligible_templates = array(
- '----------' => 'N/A',
- 'about.tpl' => 'about',
- 'identification.tpl' => 'identification',
- 'mainpage_categories.tpl' => 'index_category_thumbnails',
- 'thumbnails.tpl' => 'index_thumbnails',
- 'redirect.tpl' => 'redirect',
- // 'menubar.tpl' => 'menubar', // TODO by blocks
- 'header.tpl' => 'header',
- 'footer.tpl' => 'tail',
- 'index.tpl' => 'index',
- 'nbm.tpl' => 'nbm',
- 'notification.tpl' => 'notification',
- 'picture_content.tpl' => 'default_content',
- 'picture.tpl' => 'picture',
- 'popuphelp.tpl' => 'popuphelp',
- 'profile.tpl' => 'profile',
- 'profile_content.tpl' => 'profile_content',
- 'register.tpl' => 'register',
- 'search.tpl' => 'search',
- 'search_rules.tpl' => 'search_rules',
- 'slideshow.tpl' => 'slideshow',
- 'tags.tpl' => 'tags',
- 'upload.tpl' => 'upload',);
+ '----------' => 'N/A',
+ 'about.tpl' => 'about',
+ 'identification.tpl' => 'identification',
+ 'mainpage_categories.tpl' => 'index_category_thumbnails',
+ 'thumbnails.tpl' => 'index_thumbnails',
+ 'redirect.tpl' => 'redirect',
+ 'menubar.tpl' => 'menubar',
+ 'menubar_categories.tpl' => 'mbCategories',
+ 'menubar_identification.tpl' => 'mbIdentification',
+ 'menubar_links.tpl' => 'mbLinks',
+ 'menubar_menu.tpl' => 'mbMenu',
+ 'menubar_specials.tpl' => 'mbSpecials',
+ 'menubar_tags.tpl' => 'mbTags',
+ 'header.tpl' => 'header',
+ 'footer.tpl' => 'tail',
+ 'index.tpl' => 'index',
+ 'nbm.tpl' => 'nbm',
+ 'notification.tpl' => 'notification',
+ 'picture_content.tpl' => 'default_content',
+ 'picture.tpl' => 'picture',
+ 'popuphelp.tpl' => 'popuphelp',
+ 'profile.tpl' => 'profile',
+ 'profile_content.tpl' => 'profile_content',
+ 'register.tpl' => 'register',
+ 'search.tpl' => 'search',
+ 'search_rules.tpl' => 'search_rules',
+ 'slideshow.tpl' => 'slideshow',
+ 'tags.tpl' => 'tags',
+ 'upload.tpl' => 'upload',);
$flip_templates = array_flip($eligible_templates);
// +-----------------------------------------------------------------------+
// | selected templates |
diff --git a/include/template.class.php b/include/template.class.php
index 0b4b3a404..d99f7ebca 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -66,6 +66,7 @@ class Template {
$this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') );
$this->smarty->register_block('html_head', array(&$this, 'block_html_head') );
$this->smarty->register_function('known_script', array(&$this, 'func_known_script') );
+ $this->smarty->register_function('known_template', array(&$this, 'func_known_template') );
$this->smarty->register_prefilter( array('Template', 'prefilter_white_space') );
if ( $conf['compiled_template_cache_language'] )
{
@@ -408,6 +409,34 @@ class Template {
}
}
+ /**
+ * This smarty "known_template" functions allows to include template
+ * If extent[$params['id']] exists, include template extension
+ * else include $params[$file]
+ */
+ function func_known_template($params, &$smarty )
+ {
+ if (!isset($params['file']))
+ {
+ $smarty->trigger_error("known_template: missing 'file' parameter");
+ return;
+ }
+
+ if (isset($params['id']) and isset($this->extents[$params['id']]))
+ {
+ $file = $this->extents[$params['id']];
+ }
+ else
+ {
+ $file = $params['file'];
+ }
+
+ return $smarty->_smarty_include(array(
+ 'smarty_include_tpl_file' => $file,
+ 'smarty_include_vars' => array()
+ ));
+ }
+
static function prefilter_white_space($source, &$smarty)
{
$ld = $smarty->left_delimiter;
diff --git a/plugins/LocalFilesEditor/admin.php b/plugins/LocalFilesEditor/admin.php
index 4f79de16b..2cd5e3afa 100644
--- a/plugins/LocalFilesEditor/admin.php
+++ b/plugins/LocalFilesEditor/admin.php
@@ -184,7 +184,13 @@ switch ($page['tab'])
'mainpage_categories.tpl',
'thumbnails.tpl',
'redirect.tpl',
- // 'menubar.tpl'
+ 'menubar.tpl',
+ 'menubar_categories.tpl',
+ 'menubar_identification.tpl',
+ 'menubar_links.tpl',
+ 'menubar_menu.tpl',
+ 'menubar_specials.tpl',
+ 'menubar_tags.tpl',
'header.tpl',
'footer.tpl',
'index.tpl',
diff --git a/template/yoga/menubar.tpl b/template/yoga/menubar.tpl
index 73259376e..cca2d5535 100644
--- a/template/yoga/menubar.tpl
+++ b/template/yoga/menubar.tpl
@@ -4,7 +4,7 @@
{if ( not empty($block->template) or not empty($block->raw_content) )}
<dl id="{$id}">
{if not empty($block->template)}
- {include file=$block->template }
+ {known_template id=$id file=$block->template }
{else}
{$block->raw_content|@default}
{/if}