Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » ImageField / Image Variable Problems (only show if something is uploaded)

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

Page: 1 2
Go to End
Author Topic: 1373 Views
  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: ImageField / Image Variable Problems (only show if something is uploaded) Link to this post

    Okay I would set it up like this
    First your RefrenzenPage.php which will act as your ReferenzPage Holder
    http://pastie.org/2237295

    Then your RefrenzPage.php which will hold your RefImages
    http://pastie.org/2237298

    Followed by the RefImage.php which will serve to hold multiple Images. This way you don't need to worry about blank fields, it will loop through existing ones wether you have 1 RefImage or 100
    http://pastie.org/2237304

    Then in your RefrenzenPage.ss you could call all preview images from the ReferenzPages underneath it. Since the PreviewImage is held on the ReferenzPage you can just call it with Children to build your menu

    <% control Children %>
       <a href="$Link">$PreviewImage</a>
    <% end_control %>


    and then in Referenz.php you could loop though all the RefImages with the following.

    <% control RefImages %>
       $Attachment
       <p>$Leistung</p>
    <% end_control %>

    Hopefully I'm not missing any commas or semicolons anywhere

  • benni91
    Avatar
    Community Member
    72 Posts

    Re: ImageField / Image Variable Problems (only show if something is uploaded) Link to this post

    Thanks!!!!
    I'll test is tomorrow. I hope it will work.
    how can i thank you ?

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: ImageField / Image Variable Problems (only show if something is uploaded) Link to this post

    Haha. You can buy me beer next time I'm in Germany

    Just glad I could help. I remember what it was like starting out with SS and PHP. I got a lot of help here, so just want to return the favour

  • benni91
    Avatar
    Community Member
    72 Posts

    Re: ImageField / Image Variable Problems (only show if something is uploaded) Link to this post

    GREAT IT WORKS !!!!
    Thank you so much !!!! and the most important thing: I understood it hmm let me say: i hope i understood it

    I'll do that if your in germany ^^

    SS is a great CMS but for me it's quite difficult to understand more complex structures, like the relations of the data object to my referenzenpage and so on.

    I just can repeat: THANKS !

    1373 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.