This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/includes/smarty/plugins/function.block.php
2008-11-26 14:50:40 -08:00

29 lines
1.3 KiB
PHP

<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: block
* Purpose: display an agilebill block
* Usage: {block module=? block=?}
* -------------------------------------------------------------
*/
function smarty_function_block($params, &$this)
{
extract($params);
if($module == 'TEMPLATE') {
$this->display('file:' . PATH_THEMES . '' . THEME_NAME . '/' . $smarty->template_dir . '' . $block . '.tpl');
} else {
if(is_file(PATH_THEMES . '' . THEME_NAME . '/blocks/' . $module . '/' . $block . '.tpl'))
$this->display('file:'. PATH_THEMES . '' . THEME_NAME . '/blocks/' . $module . '/' . $block . '.tpl' );
elseif (is_file(PATH_THEMES . '' . DEF_THEME_N . '/blocks/' . $module . '/' . $block . '.tpl'))
$this->display('file:' . PATH_THEMES . '' . DEF_THEME_N . '/blocks/' . $module . '/' . $block . '.tpl');
elseif (is_file(PATH_THEMES . 'default/blocks/' . $module . '/' . $block . '.tpl'))
$this->display('file:' . PATH_THEMES . 'default/blocks/' . $module . '/' . $block . '.tpl');
else
$this->display('file:'. PATH_THEMES . '' . DEF_THEME_N . '/blocks/core/invalid_page.tpl');
}
}
?>