안녕하세요 갤러리 페이지가 있습니다. 이 갤러리 페이지은 갤러리 이미지 객체과 has_many 관계를 가지고 있습니다.데이터 객체의 업로드 폴더를 관련 페이지의 제목으로 설정 - Silverstripe 3.1
private static $has_many = array(
'GalleryImages' => 'GalleryObject'
);
내 갤러리 개체는 이미지 업로드 필드가 있습니다. 난 내가 어떤 결과
$visual->setFolderName('Galerie/'.$this->Gallery()->Title);
이 (내가 선호하는 것)
public function getGalleryTitle() {
$galleryTitle = $this->Gallery()->Title->First();
$uploadFolder = str_replace(' ', '-', $this->$galleryTitle);
return $uploadFolder;
}
$visual->setFolderName('Galerie/'.$this->$uploadFolder);
두 번째로이 시도
갤러리 페이지의 제목에 업로드 폴더를 설정하려면 반환 및 오류 (정의되지 않은 변수 uploadFolder?!) 및 내 업로드 폴더가 이제 "Galerie/DataList"로 설정되었습니다.
누군가가 내게 어떻게 알 수 있습니까? o 제목을 되 찾을 수 있도록 $ uploadFolder의 출력을 변환 하시겠습니까?
편집 :
GalleryHolder : http://www.sspaste.com/paste/show/5267dea3579a6
GalleryPage : http://www.sspaste.com/paste/show/5267dee4c9752
GalleryObject : 당신이 거의 http://www.sspaste.com/paste/show/5267df0af1a65
'GalleryPage', 'GalleryImages'및 'Gallery()'에서 'Gallery()'의 출처를 모르면 코드를 사용하여 클래스를 게시 할 수 있습니까? 클래스와 관계 정의로 코드를 게시 할 수 있다면 적절한 코드를 제공 할 수 있습니다. – colymba
물론, 내가 질문을 편집 – invictus