2012-12-23 2 views
0

Smarty를 올바르게 사용하려고하면 설정 파일을 만들었습니다. http://www.smarty.net/docs/en/language.config.variables.tpl 이 작동하지 않습니다 여기에 설명 된대로 {config_load "main.conf"} : main.tpl에서Smarty : 구성 파일을 찾을 수 없습니다.

/Smarty/ 
/Smarty/cache 
/Smarty/configs 
/Smarty/configs/main.conf 
/Smarty/plugins 
/Smarty/sysplugins 
/Smarty/templates_c 
/templates/ 
/templates/main.tpl 
index.php 

내가 의해 /Smarty/configs/main.conf에서 main.conf를로드하려고 : 파일 구조는 다음과 같다 ("치명적인 오류 : catch되지 않은 예외 메시지 'SmartyException'에서 ... main.conf을 '' '설정 파일을 읽을 수 없습니다'") :

{config_load "/var/www/vhosts/*domain*/subdomains/cms/httpdocs/Smarty/configs/main.conf"} 

하지 않는 이유는 첫 번째 예, 그러나이 작업을 수행 작업? 이전에 config dir을 설정했습니다.

$smarty->setConfigDir(SMARTY_DIR.'configs/'); 

config dir을 찾을 수 없습니다. 누군가 나를 도울 수 있을까요? 미리 감사드립니다!

+0

'setConfigDir'을 호출 한 후에'$ smarty-> getConfigDir()'을 출력하면 실제 경로를 볼 수 있습니다. – Eugene

+0

@Eugene 경로가 올바른 것으로 보입니다. 그것은 print_rs : "Array ([0] =>/var/www/vhosts/* domain */subdomains/cms/httpdocs/Smarty/configs /)" –

+0

파일의 사용 권한을 확인할 수 있습니까? 파일에 읽기 권한이 없을 수 있습니다. –

답변

1

나는 똑같은 문제가있어, 나는 CodeIgniter에서 똑똑하게 통합되어있다. 이것은 내가 $smarty->addConfigDir('YourPath');

다음 브라우저에서 var_dump($this->smarty->getConfigDir());를 인쇄 될 수 있습니다 귀하의 경우
1) $this->smarty->addConfigDir('YourPath');
을 한 것입니다. 귀하의 경우
는 귀하의 경우 $this->smarty->setConfigDir('YourPath');$smarty->setConfigDir('YourPath');
내 경우에 작동 될 수 있습니다 변경 될 수 있습니다 그 후 var_dump($smarty->getConfigDir());

2) 될 수 있습니다. 여기

0

내가 사용하는 설정의 샘플이며 나와 함께 잘 작동하고이 설정 최신 유식 판 스마티 3.x를 함께 잘 작동

/////Smarty including 
require_once('libs/Smarty.class.php'); 
$smarty = new Smarty(); 
$smarty->template_dir = 'template'; // template folder 
$smarty->compile_dir = 'cache'; // Create a Folder Cache with 777 Permission 

관련 문제