I have some items in GridField which I want listed in that page types template.
How do I do this??
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
I have some items in GridField which I want listed in that page types template.
How do I do this??
Assuming you have a relationship set up called 'GridFieldItems' eg:
private static $has_many = array(
'GridFieldItems' => 'GridFieldItem'
);
You can access that relationship in the template with:
<% if GridFieldItems %>
<% loop GridFieldItems %>
do something...
<% end_loop %>
<% end_if %>
I've tried that but all it does is output 1 thing as there's one GridField item...
So for example
<% loop MailingList %>
$Email :):):)
<% end_loop %>
Will output
:):):)
---
Edit
OOOHHHH it worked after I put in the 's' to MailingList haha
Thanks for the help!