Hi UncleCheese,
I'm looking for an example that allows to show on the frontend the details of the object.
Is there anything available?
Thanks a lot in advance.
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.
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
Hi UncleCheese,
I'm looking for an example that allows to show on the frontend the details of the object.
Is there anything available?
Thanks a lot in advance.
Not sure what you mean?
Hi idefix,
I believe what you're trying to do is display all (or some) of the data that you're managing with DataObjectManager on the front end of your site?
If so, in SilverStripe you do this with a "control block" - which makes things pretty easy.
First you need to get the DataObjectSet of whatever DataObject you're wishing to display on your Page type: (Page.php, TestimonialPage.php etc)
Make sure you do this in your Page_Controller class!
function Testimonials() {
$testies = DataObject::get("Testimonials");
return $testies;
}
Then on your Template (Page.ss, TestimonialPage.ss) - you can display the DataObject as follows:
<% control Testimonials %>
$Name
$Date.Nice
$Comment
$Author
<% end_control %>
Hopefully that's what you were after!
Hi subvert,
thanks a lot, but how must the link look like to invoke the detail page?
In the backend it looks like this: http://DOMAIN/admin/EditForm/field/OBJECT/item/226/edit
My code in the ss-file is as follows and I'd like to click on one table row to get the whole information about one person
<% if Anmeldungen %>
<p style="text-align: center;"><strong>Angemeldete Teilnehmer</strong></p>
<table border="0" cellspacing="0" width="600" align="center" style="border-width: 1px; border-style: solid;">
<thead>
<tr style="background-color: #a3bfdb;">
<td><strong>Nummer</strong></td>
<td><strong>Vorname</strong></td>
<td><strong>Nachname</strong></td>
<td><strong>Status</strong></td>
</tr>
</thead>
<tbody><tr style="background-color: #f0f0ff;">
<% control Anmeldungen %>
<% if Even %>
<tr style="background-color: #f0f0ff;">
<% else %>
<tr>
<% end_if %>
<td>$Pos</td>
<td>$vorname</td>
<td>$nachname</td>
<td>angemeldet</td>
</tr>
<% end_control %>
</tbody>
</table>
<% end_if %>
Hi Unclecheese, First of all great job with all this work!
Secondly, should the resource pages work 'out of the box'?
All im trying to do is create a download page from docs uploaded in the admin section.
I have put the php in the code folder and the .ss file within my template/layouts.
Everything seems to work. Can upload files. can publish the page etc. but when going to the page there is no download 'link' as such.
Also after refreshing that page there is a JS error on the admin section and it wont go any further.
Error is here: http://img530.imageshack.us/img530/1282/issue.jpg
Would be really grateful if you could give me a hand on this as my site is almost complete :)
Many Thanks
Craig
What version of DOM and SS are you running? Have you seen the "Code Examples" sticky in this forum? That might be a more reliable source of example code.
Hi,
Im using 2.4 SS and r403 of DOM.
The code im using i got from the top of this thread in your example code zip file.
Thanks
Craig
Hi,
would really like to see this working. But apperently it doesn't for me. I'm using r511 and SilverStripe 2.4 (just downloaded)
I extracted the examples from the top of this post and put the php files in the /mysite/code folder and the .ss files in /themes/mytheme/templates/Layout
I can create a Testimonial site but all it gives me is a blank page in the middle and no errors show up, even though 'dev' mode is used.....
Any help???
Greetz
Spanky