aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2008-10-11 17:21:52 +0000
committerpatdenice <patdenice@piwigo.org>2008-10-11 17:21:52 +0000
commita06bada6e8425817ef4f2ed8faa97be3bc9b3c19 (patch)
treeb106df10becd773038284c48be0cfc40421d9368
parent712b4e3d5c373ae020fd13df626a6f0719954c3c (diff)
- Remove known_template function.
- Replace it by a modifier function: get_extent. git-svn-id: http://piwigo.org/svn/trunk@2716 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/template.class.php46
-rw-r--r--template/yoga/menubar.tpl2
2 files changed, 13 insertions, 35 deletions
diff --git a/include/template.class.php b/include/template.class.php
index d99f7ebca..fafbf7670 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -64,9 +64,9 @@ class Template {
$this->smarty->assign_by_ref( 'pwg', new PwgTemplateAdapter() );
$this->smarty->register_modifier( 'translate', array('Template', 'mod_translate') );
$this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') );
+ $this->smarty->register_modifier( 'get_extent', array(&$this, 'get_extent') );
$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'] )
{
@@ -153,13 +153,9 @@ class Template {
{
unset($this->files[$handle]);
}
- elseif (isset($this->extents[$handle]))
- {
- $this->files[$handle] = $this->extents[$handle];
- }
else
{
- $this->files[$handle] = $filename;
+ $this->files[$handle] = $this->get_extent($filename, $handle);
}
}
return true;
@@ -209,6 +205,16 @@ class Template {
}
return true;
}
+
+ /** return template extension if exists */
+ function get_extent($filename='', $handle='')
+ {
+ if (isset($this->extents[$handle]))
+ {
+ $filename = $this->extents[$handle];
+ }
+ return $filename;
+ }
/** see smarty assign http://www.smarty.net/manual/en/api.assign.php */
function assign($tpl_var, $value = null)
@@ -409,34 +415,6 @@ 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/template/yoga/menubar.tpl b/template/yoga/menubar.tpl
index cca2d5535..97857d4f0 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)}
- {known_template id=$id file=$block->template }
+ {include file=$block->template|@get_extent:$id }
{else}
{$block->raw_content|@default}
{/if}