Re: [SMARTY] upgrading & plugins
| From: | Jan Rosier | Date: | Tue, 12 Aug 2003 08:23:04 +0000 |
| Subject: | Re: [SMARTY] upgrading & plugins | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10038@lists.php.net to get a copy of this message | ||
Martin Kloss <martin.kloss@triquart.de> wrote:
> Hi everyone,
>
> when upgrading Smarty, I always have the problem that
> I have numerous additional custom plugins in the plugins
> folder. I have a symbolic link to the latest Smarty release,
> so upgrading usually takes only a second, after extracting
> the contents from the archive. But after that I have to
> copy all my additional plugins into the new plugins folder,
> so they will be found. Not good.
>
> What's a good technique to upgrade smarty and keep
> the currently installed plugins referenced? Does anyone
> else have this problem?
>
> Martin.
>
>
> Martin Kloss
> martin.kloss@triquart.de
> Technische Direktion
Hello Martin,
Monte was so good to make it possible to use more than one plugin dir. To
make upgrading easy make a extra plugin dir for your own plugins
Below is a example for the dir structure that I use (php-include/ is in the
include_path of PHP)
php-include/
Smarty/
plugins/
2.5.0/
plugins/
// Template object...
require_once('Smarty/2.5.0/Smarty.class.php');
class Smarty_Extension extends Smarty
{
function Smarty_Extension()
{
parent::Smarty();
$this->template_dir = '/home/website/templates';
$this->compile_dir = '/home/website/templates_c';
$this->config_dir = '';
$this->plugins_dir = Array('plugins', '../plugins'); // <= !!
extra
plugin dir
$this->use_sub_dirs = FALSE;
$this->_checkVersion();
}
/**
* This method check the current version of Smarty. On different
* versions the compiled and cached templates are deleted.
*
* @access private
*/
function _checkVersion()
{
$fname = $this->compile_dir . '/smarty-release-' . $this->_version;
if (!file_exists($fname)) {
$this->clear_all_cache();
$this->clear_compiled_tpl();
touch($fname);
}
}
}
$smarty = new Smarty_Extension;
Greetings,
Jan Rosier
* A good laugh is sunshine in a house. (William Makepeace Thackeray) *