3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 676 Views |
-
Access a $db-field in Parent page of Page with DataObject and saving images to custom folder in 2.4

1 August 2010 at 5:49pm Last edited: 1 August 2010 5:53pm
Hi guys. I have a "holder" page that is holding subpages, one of which is a simple one album gallery. I have an AssetFolder field in the $db of the holder page to name the subfolder in /assets that all the files from any subpage upload will be stored in. I am trying to setup an AlbumImage class, that would save in the /assets/AssetFolder/images class, for example.
Firstly, I would like to know how to access the AssetFolder from my class if the tree is like this:
Holder > OneAlbumGallery Page > Dataobject (AlbumImage)
class AlbumImage extends DataObject {
static $db = array(
'Name' => 'Text',
'Description' => 'Text',
);
static $has_one = array (
'File' => 'Image',
'Page' => 'OneAlbumGallery'
);
function getCMSFields_forPopup() {
//$assetFolder = $this->Page->Parent->AssetFolder();
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new SimpleImageField('File','Select image',null,null,null,$assetFolder.'/images')
);
}
}Secondly, it seems that even if I enter the correct AssetFolder by hand in the code above, the images are still saved in the Uploads. I thought this had been resolved in 2.4? Maybe I'm using the wrong syntax?
| 676 Views | ||
|
Page:
1
|
Go to Top |

