Jump to:

3432 Posts in 1025 Topics by 865 members

Template Questions

SilverStripe Forums » Template Questions » Arguments to control function

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

Page: 1 2
Go to End
Author Topic: 3807 Views
  • JuLo
    Avatar
    Community Member
    37 Posts

    Re: Arguments to control function Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Arguments to control function Link to this post

    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.

  • JuLo
    Avatar
    Community Member
    37 Posts

    Re: Arguments to control function Link to this post

    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

    Attached Files
  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Arguments to control function Link to this post

    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.

  • JuLo
    Avatar
    Community Member
    37 Posts

    Re: Arguments to control function Link to this post

    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.

    3807 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.