Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update to version 3.1.28, templates cannot be loaded #134

Closed
yourchoice opened this issue Dec 16, 2015 · 11 comments
Closed

After update to version 3.1.28, templates cannot be loaded #134

yourchoice opened this issue Dec 16, 2015 · 11 comments

Comments

@yourchoice
Copy link

After update to version 3.1.28, templates cannot be loaded:

Fatal error: Uncaught --> Smarty: Unable to load template file 'admin/index.tpl' <-- thrown in E:_prjutils\lib3\smarty\sysplugins\smarty_internal_template.php on line 139.

@GAngZta85
Copy link

Use setTemplateDir()
The member var $template_dir is now private

@yourchoice
Copy link
Author

I tried $smarty->setTemplateDir(ROOT_DIR . 'templates/'); but same error.

@uwetews
Copy link
Contributor

uwetews commented Dec 16, 2015

$template_dir was private already already long time. An direct access to it should internally call setTemplateDir(). This was broken.
See #121

Does constant ROOT_DIR include a trailing '/' ?

Call $smarty->testInstall(); after setTemplateDir() to check the folder setup

@yourchoice
Copy link
Author

Hi,

Thank you for answers.

Before i had smarty 3.1.27 and worked with:

...
define('ROOT_DIR', '/airway/');
...
$smarty->template_dir = ROOT_DIR . 'templates/';
$smarty->compile_dir = ROOT_DIR . 'tmp/templates_c/';
$smarty->config_dir = ROOT_DIR . 'templates/configs/';
$smarty->cache_dir = $smarty->compile_dir . 'cache/';
....
<<

Seems that the problem is ROOT_DIR definition. With: "define('ROOT_DIR', 'E:/airway/');" and set methods working. Maybe better if work and with : "define('ROOT_DIR', '/airway/');"

Thank's.

@uwetews
Copy link
Contributor

uwetews commented Dec 17, 2015

Recheck your example with the updated version in the master branch. It should work now same way as in 3.1.27

@iquito
Copy link

iquito commented Dec 20, 2015

This also broke my application - using setTemplateDir instead of the template_dir variable fixed it for now. Maybe there should be a bugfix release, because a lot of applications could have the same problems when updating.

@iquito
Copy link

iquito commented Dec 20, 2015

Actually, setTemplateDir does not solve the problem - Smarty then creates the templates_c directory in my root project directory and writes all files in there, the directory I set with setTemplateDir is not used. Smarty also attempts to do the same when setting the template_dir variable (it also creates the template_c directory in project root) but then it does not find its own templates.

@uwetews
Copy link
Contributor

uwetews commented Dec 20, 2015

setTemplateDir() does set up the template_dir not compile_dir (template_c).
The later is set by setCompileDir().

We will soon release 3.1.29 with bugfixes

@uwetews
Copy link
Contributor

uwetews commented Dec 20, 2015

define('ROOT_DIR', '/airway/');
did confuse Smarty as you used the Linux separator '/' and it looked like an absolute path.
define('ROOT_DIR', './airway/');
should work.

But I will add additional checks for the OS type.

@uwetews
Copy link
Contributor

uwetews commented Dec 20, 2015

Te fix is now in the master branch

uwetews added a commit that referenced this issue Dec 21, 2015
uwetews added a commit that referenced this issue Dec 21, 2015
…ize to the root dir

    of current working drive #134 (reverted from commit e298343)
@uwetews
Copy link
Contributor

uwetews commented Dec 21, 2015

Now it got it. a path like '/airway/' on windows should normalize to the root dir of the current working drive. This is now fixed in the master branch.

@uwetews uwetews closed this as completed Dec 21, 2015
uwetews added a commit that referenced this issue Dec 21, 2015
…ize to the root dir

    of current working drive #134 (reverted from commit e298343) (reverted from commit 5a418ef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants