This code works, because I obviously have declared a default value to be used with the returnimages() function.
My problem is that I want returnimages() to use the value collected from the CMS $FolderForFadeBanner.
I tried things like $returnimages($FolderForBanner) or <% control $returnimages($FolderForBanner) %> $files <% end_control %> in the ss file or declaring the function $returnimages($FolderForBanner) in the php file, but all to no avail.

At best, my slideshow works with the default folder.
At worst, I get an error, saying that I do not have enough arguments for returnimages.

Help please someone?

I know I am probably doing something really stupid, but I can't figure it out.

Thanks,

JuLo

[EDIT: Removed some more code that was not necessary. My post is still too long. Sorry. ]

I am however a bit confused.
Isn't using "<% control $returnimages($FolderForBanner) %>" just like passing variables into functions? (which you said cannot be done)
Would the usage be something like
<% control $returnimages($FolderForBanner) %>
$files //where files is a variable used in the returnimages(path) function
<% end_control %>

And if I were to use the $this->FolderForBanner method, it returns a Folder Object.
How can I use it with opendir() , which requires a string argument?

How to get the $FolderForBanner from its ID ($this->FolderForBannerID)?

That does return a Folder Object, if you want to call the link to the file have alook at the API for File - http://api.silverstripe.org/sapphire/filesystem/File.html for a method which returns the path. Think you need to use something like getFilename() will have the path - /assets/Uploads/File.html

Yes, $this-> FolderForFadeBannerID will get you the ID of the folder since its as has_one the fieldname has the ID appended to it.

Sorry to hassle you, but I still don't know how to get to the $FolderForBanner from its ID.

$this->FolderForBanner is not set, while $this->FolderForBannerID is.

Should it be something like FolderForBanner($this->FolderForBannerID)?

In any case, thanks a lot for that link to the API.
I've been using Silverstripe for a couple of weeks and did not see it before.
I was only guessing so far... ;-)
FYI the function I will use will be getRelativePath()