5328 Posts in 1598 Topics by 1168 members
|Go to End||Next >|
3 December 2009 at 6:12am
I'd like to modify FileField (or create a new type of field) so it can accept a folder instead of only files.
(I basically just want to have a browse button and save the path that I pointed to)
Can anyone point me into the right direction?
3 December 2009 at 10:24am
I don't quite understand what you're trying to do.
Do you want to select a folder on your local computer and store the path to that folder?
Or do you want to be able to select a folder on the server (from the assets folder)?
3 December 2009 at 12:22pm
A folder on the server.
I've created a sort of slideshow in Flash and would like to be able to pass a path to it (through a php) to tell it which folder to get its pictures from.
Thanks in advance for your help.
3 December 2009 at 5:14pm
You can just use TreeDropdownField with a DataObjectSet of all the folders. Something like "new TreeDropdownField('Folder', 'Select a Folder', 'Folder')" should do the job.
4 December 2009 at 1:17pm
Oh OK. That seems simple enough.
I'll give that a shot.
8 December 2009 at 8:24pm Last edited: 8 December 2009 9:07pm
I tried it by including this in my pages getCMSfields
$fields->addFieldToTab("Root.Content.Banner", new TreeDropdownField("FolderForBanner", "Choose a folder to get the images for the slideshow from", "Folder"));
It seems to work.
But I don't know how to use the selected path in the .ss Page.
If I just put $FolderForBanner in the ss file, it obviously cannot work.
How to turn this "path object" into a string?
Some more help please?
8 December 2009 at 11:38pm
First get the folder-object in your code .... And feed that to your template :
$tmpFolder = DataObject::get_by_id("Folder",$FolderForBannerID);
9 December 2009 at 12:21am
Actually that is completely unnecessary. You can just access a $has_one relationship in your template by using $HasOneName. You then can do $HasOneName.URL or $HasOneName.RelativePath or whatever in your template.
|Go to Top||Next >|