Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

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.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Using DataObject item on another page


Go to End


2 Posts   1409 Views

Avatar
sca123

Community Member, 61 Posts

13 April 2010 at 10:35pm

Hi
I am using DataObject for a News area of the site (its a better solution for the design than the blog) - so I have NewsItem.php (that extends the DataObject), NewsPage.php that $has_many NewsItems, and NewsPage.ss that calls all of the news items through <% control NewsItems %>. Each NewsItem has a 'Title' and 'Description' defined.

This all works great.

What I now want to do is pull the latest NewsItem from the above DataObject into Page.php.

Any help would be great
Thanks

Avatar
sca123

Community Member, 61 Posts

13 April 2010 at 10:58pm

Its ok, I have resolved this by using <% control.Last %>. Easy when you know how.