Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
Data Model Questions
SilverStripe Forums » Data Model Questions » Dataobject association
|
Page:
1
|
Go to End | |
| Author | Topic: Dataobject association | 315 Views |
-
Dataobject association

12 June 2009 at 9:41pm
Hi all,
Quick question. I have a page that is listing out all iterations of a data object. Each iteration is associated with one of the page's children.
How would I retrieve the child page association from the parent?
IE:
Child->Title
Child->ContentCurrently I am using this (very simple) method and iterating through the results in the template file:
public function GalleryList() {
$GalleryList = DataObject::get('ObjectPeekImage');
return $GalleryList;
}Any help in this would be appreciated.
Mo
-
Re: Dataobject association

15 June 2009 at 10:46am
That's a little confusing. Are you trying to figure out if the page related to ObjectPeekImage is also related to the current page? Or, just get the page related to ObjectPeekImage? Although you say it is related to "the page's children" - so surely you already know the relationship?
Put it this way, if ObjectPeekImage has a has_one relationship with a page (say "MyPage"), surely you can just do:
<% control GalleryList %>
<% control MyPage %>
<h2>$Title</h2>
<div>$Content</div>
<% end_control %>
<% end_control %> -
Re: Dataobject association

15 June 2009 at 10:02pm
That is EXACTLY what I was after, thank you soooooo much
.
Mo
| 315 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: Punch Rockgroin
Welcome to our latest member: Bud


