0
내 로컬 테스트 서버에서 Smarty Template Engine이 제대로 작동하는 데 문제가 있습니다. 나는 그것이 같은 설정이 있습니다 그러나로컬 서버에서 Smarty 템플릿이 작동하지 않습니다.
<?php
// put full path to Smarty.class.php
require('smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->testInstall();
$smarty->setTemplateDir('smarty/templates');
$smarty->setCompileDir('smarty/templates_c');
$smarty->setCacheDir('smarty/cache');
$smarty->setConfigDir('smarty/configs');
$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');
?>
,이 오류가 계속 :
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in /var/www/WEBSITE/smarty/sysplugins/smarty_internal_templatebase.php:127 Stack trace: #0 /var/www/WEBSITE/smarty/sysplugins/smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('index.tpl', NULL, NULL, NULL, true) #1 /var/www/WEBSITE/test.php(13): Smarty_Internal_TemplateBase->display('index.tpl') #2 {main} thrown in /var/www/WEBSITE/smarty/sysplugins/smarty_internal_templatebase.php on line 127
나는 testInstall 기능을 사용하고이 반환되었습니다 :
Smarty Installation test...
Testing template directory...
/var/www/SteamKing/templates is OK.
Testing compile directory...
FAILED: /var/www/SteamKing/templates_c is not writable.
Testing plugins directory...
/var/www/SteamKing/smarty/plugins is OK.
Testing cache directory...
FAILED: /var/www/SteamKing/cache is not writable.
Testing configs directory...
FAILED: ./configs/ does not exist.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.
내가 겪은 전체 폴더를 실제로 쓰기 가능하고 모든 것을하지만 난 여전히 오류가 발생하는지 확인합니다. 어떤 아이디어?
원하는 템플릿으로 ur 템플릿 디렉토리를 확인하는 디버깅을 수행합니다. $ smarty-> getTemplateDir(); 똑똑한 객체가 가리키는 디렉토리에 색인 파일이 있습니다. – Dinesh
이것은 사용자 서버 환경에 따라 다르지만, 아파치의 사용자 이름이 해당 디렉토리의 소유자인지 확인하십시오. 단지 '777'로 만들면 항상 효과가 없을 수도 있습니다. –