17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 761 Views |
-
question to DataObject

17 November 2008 at 3:48am Last edited: 17 November 2008 5:41am
hi,
i want to modify the tutorial 5.
now, i have a Project -> extends Page, that has a Student tab, where i can add some students. and i have a Student.php -> extends DataObject.
each student is a Student DataObject.
when i come to my project page, i want to display all students.
i suppose, i need a function in Project.php that returns all the Student datafields...
can someone show me how to write such a function?thanks!
in the Project.Php i have:
static $has_one = array(
'Students' => 'Student'
);so should i use in my template:
<% control Students %>
... some html
<% end_control %>but this doesn't work...
-
Re: question to DataObject

17 November 2008 at 6:13am Last edited: 17 November 2008 6:13am
so, i downloaded the sourcefiles of tutorial 5, copied them in their folders, run db/build?flush=1,
entered some students and mentors in the project - this is working properly, but none is displayed in the published site...did enything changed to the tutorial 5 in ss 2.3 rc1 ??
if you know soething that could help, let me know!
thanks
-
Re: question to DataObject

18 November 2008 at 8:44am Last edited: 18 November 2008 8:45am
from a project holder template, you could write:
<% control Children %>
<ul>
<% control Students %> //or <% control MyStudent %> if your variables match the tutorials code.
<li>$FirstName $Lastname</li>
<% end_control %>
</ul>
<% end_control %>this works in 2.2.3, but havent tried in 2.3rc1
| 761 Views | ||
|
Page:
1
|
Go to Top |

