7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » DataObjectManager Code Examples
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 17999 Views |
-
Re: DataObjectManager Code Examples

13 April 2010 at 9:54pm
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.
-
Re: DataObjectManager Code Examples

14 April 2010 at 2:43am Last edited: 14 April 2010 2:44am
Not sure what you mean?
-
Re: DataObjectManager Code Examples

14 April 2010 at 8:47am
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!
-
Re: DataObjectManager Code Examples

15 April 2010 at 9:53pm
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 %> -
Re: DataObjectManager Code Examples

24 July 2010 at 1:55am
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 -
Re: DataObjectManager Code Examples

24 July 2010 at 2:26am
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.
-
Re: DataObjectManager Code Examples

24 July 2010 at 2:30am
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 -
Re: DataObjectManager Code Examples

16 November 2010 at 11:13pm
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
| 17999 Views | ||
| Go to Top | Next > |


