7 * Create a Smarty instance.
11 public static function createSmarty($srcPath) {
12 require_once 'CRM/Core/I18n.php';
14 $packagePath = PackageUtil
::getPath($srcPath);
15 require_once $packagePath . DIRECTORY_SEPARATOR
. 'Smarty' . DIRECTORY_SEPARATOR
. 'Smarty.class.php';
17 $smarty = new \
Smarty();
18 $smarty->template_dir
= implode(DIRECTORY_SEPARATOR
, [$srcPath, 'xml', 'templates']);
19 $smarty->plugins_dir
= [
20 implode(DIRECTORY_SEPARATOR
, [$packagePath, 'Smarty', 'plugins']),
21 implode(DIRECTORY_SEPARATOR
, [$srcPath, 'CRM', 'Core', 'Smarty', 'plugins']),
23 $smarty->compile_dir
= \Civi\Setup\FileUtil
::createTempDir('templates_c');
24 $smarty->clear_all_cache();
26 // CRM-5308 / CRM-3507 - we need {localize} to work in the templates
27 require_once implode(DIRECTORY_SEPARATOR
, [$srcPath, 'CRM', 'Core', 'Smarty', 'plugins', 'block.localize.php']);
28 $smarty->register_block('localize', 'smarty_block_localize');
29 $smarty->assign('gencodeXmlDir', "$srcPath/xml");