CI 묻고 답하기

제목 탬플릿 언더바
글쓴이 씨아이세상 작성시각 2011/10/21 18:08:13
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 25721   RSS

cannot find defined template http://127.0.0.1/system/application/views//skin/welcome.tpl

테스트연습중인데 초보입니다..템플릿언더바 적용좀하려는데
에러가나서요 

//controller bolg.php
 class Blog extends Controller{
  function Blog(){
   parent::Controller();
  }

  function index()
  {
   $this->load->library('templateclass');
   $this->load->library('templatecompiler');

   $this->templateclass->define('welcome', 'welcome.tpl');
   $this->templateclass->assign(array(
    'title'  =>'First Template_',
    'content'=>'Fill me in',
   ));
   $this->templateclass->print_('welcome');
  }}
template 는
libraries/
Templateclass.php
Templatecompiler.php

이렇게 되있고요
welcome.tpl 은 views밑에잇고

Templateclass
설정은
 var $compile_check = true;
 var $compile_dir   = 'http://127.0.0.1/system/application/labraries/Templage_';
 var $compile_ext   = 'php';
 var $skin          = 'skin';
 var $notice        = false;
 var $path_digest   = false;

 var $template_dir  = 'http://127.0.0.1/system/application/views/';
 var $prefilter     = '';
 var $postfilter    = '';
 var $permission    = 0777;
 var $safe_mode     = false;
 var $auto_constant = false;

 var $caching       = false;
 var $cache_dir     = '_cache';
 var $cache_expire  = 3600;
이렇게 돼잇는데 경로가 틀려서그런가??

 다음글 쿠기가 브라우져 특성을 타는데 혹시 아시는분..? (4)
 이전글 CI세션에서 정해진 타임동안 활동이 없으면 끊어지는것.... (1)

댓글

DJ구스 / 2011/10/22 00:56:04 / 추천 0
 모든 정답은 에러 메세지에 있습니다.
참고로 제가 쓰는 걸 첨부 했습니다. 나머진 비교하셔서 해보세요..
자세히 보시면 뭐가 틀렸는지 나옵니다. 

힌트 '경로'를 잘 보시길 바랍니다.

cannot find defined template http://127.0.0.1/system/application/views//skin/welcome.tpl
 


<?php if  ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once(APPPATH . 'libraries/template_/Template_.class.php');


class Template extends Template_ 
{
 var $tpl;
 
 var $compile_dir   = '_compile';
 var $compile_ext   = 'php';
 var $skin          = '';
 var $notice        = false;
 var $path_digest   = false;

 var $template_dir  = '_template';
 var $prefilter     = '';
 var $postfilter    = 'removeTmpCode | arrangeSpace';
 var $permission    = 0777;
 var $safe_mode     = false;
 var $auto_constant = false;

 var $caching       = false;
 var $cache_expire  = 0;
 
 function __construct()
 {
  $this->compile_dir = BASEPATH . '../../_compile';
  $this->template_dir = APPPATH . 'views';
 }
    
}

/* End of file Template.php */
/* Location: ./system/application/libraries/Template.php */


DJ구스 / 2011/10/22 00:58:13 / 추천 0
 그런데 소스를 다시 보니깐.. 전혀 Tmplate_를 이해 못하셨는거 같은데여..

compire_dir 은 파싱한 파일을 php로 해서 저장해서 웹에서 보여지도록 하는 폴더 입니다.

물론 읽고 쓰고 권한이 되어야 하구요. .  www.xtac.net 가셔서 좀더 메뉴얼을 보시기 바랍니다.
그리고 라이브러리에 추가해서 쓰시면 속도면과 트래픽 용량을 부분을 많이 줄여 줄 수가 있는 emoveTmpCode | arrangeSpace';

추가 강추.
한대승(불의회상) / 2011/10/24 10:52:13 / 추천 0
템플릿 디렉토리나 컴파일 디렉토리는 일반적으로 로컬 경로를 사용하는데...
좀 이상하군요.

 var $compile_dir   = 'http://127.0.0.1/system/application/labraries/Templage_';
 var $template_dir  = 'http://127.0.0.1/system/application/views/';
// 요렇게 수정해 보세요.

 var $compile_dir   = '<CI가설치된경로>/system/application/labraries/Templage_';
 var $template_dir  = '<CI가설치된경로>/system/application/views/';
템플릿의 경우 컴파일이 되면 저장이 되니 퍼미션도 확인해 주세요.
씨아이세상 / 2011/10/26 18:03:20 / 추천 0

경로를 요리조리 잘맟쳐서 성공햇어요..ㅎㅎ
게속 공부중입니다..ing

한대승(불의회상) / 2011/10/26 18:22:29 / 추천 0
씨아이세상// 수고 하셨습니다. 성공하셨다니 기쁩니다. ^^
오늘도 CI와 함께 즐거운 코딩 되세요.