글쓴사람 나이키
글쓴시간2004년 7월 28일 오후 6시 58분 13초
    제목경로보정오류 문의드립니다.
Template_ 적용 중 상대경로보정 오류가 나고 있습니다.
나름대로 고민하고 게시판도 검색해 보았으나, 해결하지 못하여 도움을 부탁드립니다.

<link rel=StyleSheet href='/_global/skin1/_css/main.css' type='text/css'>
와 같이 나와야 하는데
<link rel=StyleSheet href='bcde/_global/skin1/_css/main.css' type='text/css'>
와 같이 나오고 있습니다.
이미지의 경우도 마찬가지 입니다.

아래는 웹서버 환경 및 관련 파일입니다.

◆ 버츄얼 호스트 설정
---------------------------------------------------
<VirtualHost *:80>
ServerName abcde.xxx.com
DocumentRoot /home/www/abcde/
</VirtualHost>
---------------------------------------------------

◆ /home/www/abcde/ 하위 디렉토리 구조
---------------------------------------------------
_global/
  ==> skin1/
      ==> _css/
          ==> main.css
      ==> head.tpl
      ==> tail.tpl
_include/
  ==> tpl_plugin/
      ==> 필터들...
  ==> Template.class.php
  ==> Template_.class.php
  ==> Template_.compile.php
_compile/
r.php
---------------------------------------------------

◆ r.php
---------------------------------------------------
<?
include("_include/Template.class.php");
$tpl = new Template;
$tpl->print_("head");
?>
---------------------------------------------------

◆ head.tpl
---------------------------------------------------
<?
<link rel=StyleSheet href='_css/main.css' type='text/css'>
?>
---------------------------------------------------

◆ 환경변수
---------------------------------------------------
DR: /home/www/abcde/
FILE: /usr/home/www/abcde/r.php
SF: /home/www/abcde/r.php
PT: /home/www/abcde/r.php
PS: /r.php
OS: FreeBSD
VER: 4.3.3
---------------------------------------------------

◆ Template.class.php
---------------------------------------------------
<?
if ($_template_included) return;
$_template_included = true;

include(dirname(__file__)."/Template_.class.php");
class Template extends Template_
{
    var $compile_check    = "dev";
    var $compile_ext    = "php";
    var $skin            = "skin1";
    var $prefilter        = "adjustPath";
   
    function Template()
    {
        $this->template_dir    = $_SERVER['DOCUMENT_ROOT']."_global";
        $this->compile_dir    = $_SERVER['DOCUMENT_ROOT']."_compile";
        $this->define(array(
            "head" => "head.tpl",
            "tail" => "tail.tpl"
        ));
    }
}
?>
---------------------------------------------------
관리자 나이키님 안녕하세요.

아파치 설정파일에서

DocumentRoot /home/www/abcde/ 을
DocumentRoot /home/www/abcde  으로 바꿔주시고

경로보정필터 12번째줄 주석을 풀고 해보시기 바랍니다.

질문을 지금 확인 했네요. 저녁 때 다시 검토후 답변드리겠습니다.
04-07-29 09:15
나이키 답변 감사합니다.
그러나 아직 아래와 같은 오류가 발생하고 있습니다.

1. 경로보정필터 12번째줄 주석만 풀었을 경우
Template_ Compiler Error #34: "adjustPath" : template file /usr/home/www/abcde/_global/skin1/head.tpl is not in document root(/home/www/abcde/)'s sub directory in /usr/home/www/abcde/_global/skin1/head.tpl

2. 아파치 설정만 수정하였을 경우(말씀해 주신대로)
Template_ Error #1: cannot find defined template /home/www/abcde_global/skin1/head.tpl

3. 1번+2번 : 경로보정필터 12번째문 주석 해제 + 아파치 설정 변경(말씀해 주신대로)
Template_ Error #1: cannot find defined template /home/www/abcde_global/skin1/head.tpl
04-07-29 17:22
관리자 충분히 읽고 답변을 했어야 했는데.. /usr 를 보지 못했네요.

/usr/home 이 /home 으로 심볼릭 링크된 경우인거 같네요.

현재 경로보정 필터가.. DOCUMENT_ROOT가 심볼릭 링크된 경우는 고려되어 있지 않습니다.


일단은 httpd.conf 파일에서

DocumentRoot /home/www/abcde/ 을
DocumentRoot /usr/home/www/abcde 로

하시고..

$this->template_dir = $_SERVER['DOCUMENT_ROOT']."/_global";

_global 과 _compile 앞에 / 를 붙이시면 되겠네요.


주말에 업데이트하도록 하겠습니다.

자세한 질문 감사합니다.
04-07-30 10:00
나이키 말씀해 주신대로 수정하니 되는군요~ 감사합니다.(꾸벅)
업데이트 나오면 심볼릭 링크로도 적용해 보겠습니다.
즐거운 주말 되시기 바랍니다.
04-07-30 11:34
관리자 감사합니다. 좋은 주말 되세요^^
04-07-30 13:20
    이름
비밀번호
 
Since 2003-03-03 hosted on vultr.com