5102 Posts in 1520 Topics by 1116 members
| Go to End | Next > | |
| Author | Topic: | 2509 Views |
-
Re: Modify FileField

9 December 2009 at 12:31am
@Fuzzio, thanks anyway.
@ajshort.
Thanks a lot.
That's what I was looking for.I have to say that it's not the first I struggle with that kind of stuff in the Silverstripe documentation.
How did you know that the content of TreeDropdownField field can be displayed as URL or as Relative path?
What are the other options?
Where do you find that kind of info?I seem to only get it from reading posts on the forum of users who have already used it before (e.g. that's how I found out about $Locale.Nice)
(Probably very weird question I know)JuLo
-
Re: Modify FileField

9 December 2009 at 12:31am Last edited: 9 December 2009 12:31am
@AJShort : Well yeah , but we are not sure he is using a has_one ... Many times I've used a dropdown to store a link to the filesystem or the sitetree without having a relationship ....
-
Re: Modify FileField

9 December 2009 at 12:38am
;-)
Haha , your previous posting beat me to it...
Good to see it's sorted ! ... ;) Good luck with your project !
-
Re: Modify FileField

9 December 2009 at 12:44am
Thanks Fuzzio.
But that just showed me that I must have done something else wrong, because my TreeDropdownField does not seem to save its content.
$FolderForBanner.URL always shows http://localhost/SilverStripe/assets/, no matter what folder I have chosen.
And in the CMS, when I change it, Save And Publish, and refresh the page, the drop down is back to "(Choose)", which I guess means that it did not save the value.
Any ideas.
-
Re: Modify FileField

9 December 2009 at 12:47am
Just a quick guess : if you are using a has_one , you should probably safe to FolderForBannerID instead of FolderForBanner ...
Please post your code...
-
Re: Modify FileField

9 December 2009 at 12:55am
OK. I have no idea what that means (what ID? Where do I get it from?), so I am posting the code. (unnecessary bits removed)
in Homepage.php
(...)
static $has_one = array(
'FolderForBanner' => 'Folder'
);public function getCMSFields(){
$fields = parent::getCMSFields();
(..)
$fields->addFieldToTab("Root.Content.Banner", new TreeDropdownField("FolderForBanner", "Choose a folder to get the images for the slideshow from", "Folder"));
(...)
return $fields;
}In the Homepage.ss
(...)
$FolderForBanner.URL
(...)And as I said earlier, it only returns "http://localhost/SilverStripe/assets/", which suggests that it does not save the value.
-
Re: Modify FileField

9 December 2009 at 1:17am
Try :
$fields->addFieldToTab("Root.Content.Banner", new TreeDropdownField("FolderForBannerID", "Choose a folder to get the images for the slideshow from", "Folder"));
| 2509 Views | ||
| Go to Top | Next > |


