Question

I have been struggling since I started developing my own modifier functions to get my Smarty environment working the way it should. Specifically I seem to have to choose between being able to use the "built-in" functions or my own but not both. I'm sure there's something I'm missing and hoping someone can point me to what I need to do.

What I've done currently is:

  1. when using the built-in functions -- modifiers like capitalize, @debug_print_var, etc. -- It seems to just work without needing to specifically point to the directory where these built-in scripts live
  2. when I developed my own scripts -- I have two of them now -- I had to be explicit about where they were to get them recognized so I added the code below:

code:

 public static function init () {
    $object = new Smarty();
    $object->setTemplateDir ( LG_FE_DIR . '/templates/uncompiled' );
    $object->setCompileDir ( LG_FE_DIR . '/templates/compiled'  );
    $object->setCacheDir ( LG_FE_DIR . '/templates/cache' );
    $object->setConfigDir ( LG_FE_DIR . '/templates/configs' );
    // $object->setPluginsDir ( LG_FE_DIR . '/externals/Smarty/libs/plugins');
    $object->setPluginsDir ( LG_FE_DIR . '/templates/plugins_dir' );

    return $object;
}

as you can see from the commented out line, I also tried to have two "setPluginsDir()" calls to both the default Smarty library as well as my own but it clearly only allows for one directory to be registered.

Any and all help would be greatly appreciated.

Was it helpful?

Solution

Try addPluginsDir. With this method you can add one or more plugin directories instead of rewrite the existing. http://www.smarty.net/docs/en/api.add.plugins.dir.tpl You can also set multiple directories with setPluginsDir ... setPluginsDir(array(DIR_1,DIR_2))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top