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

ImageField / Image Variable Problems (only show if something is uploaded)


Go to End


12 Posts   3273 Views

Avatar
zenmonkey

Community Member, 545 Posts

20 July 2011 at 2:17am

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 :)

Avatar
benni91

Community Member, 72 Posts

20 July 2011 at 8:49am

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

Avatar
zenmonkey

Community Member, 545 Posts

20 July 2011 at 8:56am

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

Avatar
benni91

Community Member, 72 Posts

21 July 2011 at 10:24am

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

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 ! :)

Go to Top