Such a problem: Previously, the site was on Linux, when transferring to my local web server on windows, Smarti began to create empty compiled files, in which only the standard Smarty comment:

<!--?php /* Smarty version 2.6.19, created on 2019-02-20 18:28:08 compiled from index.tpl */ ?--> 

Version smarty - 2.6.19 Folder paths are specified correctly. There are no problems with rights, because this is a Windows. I tried to put Smarty_Test.class.php and do a test, here is the result:

 string(42) "Z:/home/svau.com/www/admin/smarty/plugins/" testing start: template_dir is 'Z:/home/svau.com/www/template/' real system path: Z:\home\svau.com\www\template file perms: 0777 OK. compile_dir is 'Z:/home/svau.com/www/admin/smarty/template-c-site/' real system path: Z:\home\svau.com\www\admin\smarty\template-c-site file perms: 0777 OK. cache_dir is 'Z:/home/svau.com/www/admin/smarty/cache/' real system path: Z:\home\svau.com\www\admin\smarty\cache file perms: 0777 OK. testing complete. 

Config:

  function mysmarty_site() { global $config; $this->Smarty(); $this->template_dir="$config[project_path]/template/"; $this->compile_dir="$config[project_path]/admin/smarty/template-c-site/"; $this->plugins_dir="$config[project_path]/admin/smarty/plugins/"; $this->config_dir="$config[project_path]/admin/smarty/config/"; $this->cache_dir="$config[project_path]/admin/smarty/cache/"; $this->default_modifiers=array('escape_ss'); $this->left_delimiter='{{'; $this->right_delimiter='}}'; $this->caching = true; $this->debugging = true; $this->force_compile = true; $this->error_reporting= E_ALL | E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR; $this->test(); die; } 

I have no idea what the problem is, please help.

  • Added a config smarti - Alexey
  • There are no problems with the rights, you are right, because the files are created. But if for example you are using IIS, then the IUSR user should be given permission to write to the directory. - teran pm
  • as a remark, the $config[project_path] after such lines check the php log file, there will be something about the undefined constant project_path , you forgot to wrap this string quotes. And for reliability and readability, still use the brackets "{$config['project_path']}" - teran
  • here they write on the forums, as an option, that the templates are located, but pkhp cannot read them, because for example, no rights, or something else. so check the php log and make sure that you have read permissions for the files themselves. in the test are true on the directory. and turn off caching - teran February

0