2012-10-05 4 views
0

내가 도서관에서 클래스 파일 내 자신의 컬렉션을 만들 찾고 있어요 내가 사용할 수 있도록하려는 다양한 클래스 파일이있을 것이다 폴더 내부/일반 폴더자동 로더 자동화 ... 사용자 정의 클래스. 어떻게 작동시킬 수 있습니까?

/library/common/*class files go in here* 

같은

DecoratorSimple.php 

코드 예는 아래에서 볼 수 있습니다.

class Common_Decorator_SimpleInput extends Zend_Form_Decorator_Abstract 
{ 
    // code goes in here 
} 

내가 가진 문제는 내가이 부트 스트랩에 다음을 추가 시도 Common_

의 접두사를 가지고 자동으로 일반 폴더에 아무것도로드 젠드 응용 프로그램을 얻을 어떻게 되나 그것을하지 않았다

protected function _initTestAutoLoader(){ 

    $autoloader = Zend_Loader_Autoloader::getInstance(); 
    $autoloader->registerNamespace('Common_'); 

    // try and load the class 
    $testVar = new Common_Decorator_SimpleInput(); 
    var_dump($test); 
} 
+0

무엇이 오류입니까? 또한, 문제는 라이브러리/라이브러리 /를'include_path'에 등록하지 않았기 때문이라고 생각합니다. – Rezigned

답변

1

를 클래스 이름이 라이브러리 경로와 일치되어 일 ...
예를 들어 Common_Decorator_SimpleInput
는/라이브러리/공통/실내 장식/SimpleInput에 있어야합니다 .php

+0

이것이 그랬습니다. 모든 "_"(분리 자)마다 여분의 폴더를 추가해야했습니다. –