2013-08-01 7 views
0

이 질문에 아마 백 번 부탁 받았지만 autoload.php에서 도우미를 부르려고합니다. shared_addons/helper에 도우미 파일을 저장했습니다. new_helpers라고했습니다. 헬퍼 파일은 다음과 같습니다 PyroCMS : autoload.php 맞춤 헬퍼를 찾지 못했습니다.

<?php defined('BASEPATH') OR exit('No direct script access allowed.'); 

public function get_date($timestamp, $format) { 
    list($date,$time) = explode("|", date("m/d/y|g:i A", $timestamp)); 
    $date = date($format, $date); 
    return $date; 
} 
public function get_time($timestamp, $format) { 
    list($date,$time) = explode("|", date("m/d/y|g:i A", $timestamp)); 
    $time = date($format, $time); 
    return $time; 
} 

및 시스템/CMS는/설정/autoload.php에서

, 내가 넣어 :

$autoload['helper'] = array('new_helper'); 

을 그러나, 나는 여전히 오류가 점점 오전 : 오류가

이었다 가 발생했습니다 [500]

요청 된 파일을로드 할 수 없습니다 : 도우미/new_helper.php

무엇 오전 내가 잘못하고있어?

+0

'나는 new_helpers'를 호출하고,'new_helper' 대신에'new_helpers'를로드합니다. –

+0

나는 헬퍼를 "new_helper"라고 불렀다. 나는 나의 질문을 편집했다. – trysis

+0

'public' 키워드로 인해 구문 분석 오류가 발생할 수 있습니다. visibility 키워드를 제거하고 다시 시도하십시오. –

답변

0

도우미 파일 이름은 템플릿 NAME_helper.php을 따라야합니다. 예를 들어 도우미의 이름을 "pdf"로 지정하려는 경우 파일 이름은 pdf_helper.php이됩니다.

로딩/자동로드를 위해 _helper 접미사없이 이름을 사용합니다. 그래서 $autoload['helper'] = 'pdf'.

+0

나는 이것을 시도했다. 나는 결국 그것을 자동로드하지 않기로 결정했지만 필요할 때로드합니다. – trysis

+0

버전 2.1.3에 대한 답변을보기 전에 테스트를 해 보았습니다. 뭐든간에 당신의 보트를 띄울 수 있습니다. –