Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Arguments to control function


Go to End


13 Posts   5545 Views

Avatar
JuLo

Community Member, 37 Posts

17 December 2009 at 2:54pm

Neither work.

$this->FolderForBanner() obviously (I think) does not work, because FolderForBanner is not a function.

$this->dbObject('FolderForBanner') does not seem to return anything.

I am actually now just only checking if if imgfolder is set with the code below:

$imgfolder = $this->dbObject('FolderForBanner');
if(isset($imgfolder))
echo $imgfolder;
else
echo 'Not Set';

And nothing I try seems to work...

It always say "Not Set"

I'm really frustrated now. I've wasted hours on something that seems so simple...

Anything else you can think of?

Again thanks for your help and sorry for being so retarded.

Avatar
Willr

Forum Moderator, 5523 Posts

17 December 2009 at 2:59pm

Are you sure FolderForBanner exists as a relationship / object. If both of those don't work this its not working. Perhaps try attaching your code.

Avatar
JuLo

Community Member, 37 Posts

17 December 2009 at 3:09pm

Edited: 17/12/2009 3:10pm

Nope, I'm not sure, because I actually don't even understand what that means.

I have used a very similar scenario last week, but I needed to access the Folder in the Page.ss, not in the Page.php.
That still works fine in this case too (i.e. I can do $FolderForFadeBanner.RelativePath in the Page.ss and it displays the right path.

I've attached Page.php and Page.ss.

(the call to $returnimages is made in a javascript block in the <head>)

Let me know if you need more.

I'm desperate.

Thanks

Avatar
Willr

Forum Moderator, 5523 Posts

17 December 2009 at 7:29pm

I just changed your code to

Debug::show($this->FolderForBanner());

Selected a file and it worked fine - it showed the Folder object. I would double check that if you do Debug::show($this->FolderForBannerID) that it doesn't return 0.

Avatar
JuLo

Community Member, 37 Posts

17 December 2009 at 7:51pm

It does work!
You are a genius!

I have no idea what went wrong before (probably a typo, as I could not see clearly anymore after all the time spent on it).
(I did not not about that Debug:: trick either. That will come in handy).

I don't know how to thank you man.

Pfeeew... Now I can get on with my life... ;-)

Thanks a lot.

Go to Top