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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Show images in ArticleHolder

Go to End



Community Member, 49 Posts

26 November 2009 at 2:05am

I have a small little problem.

I have made an ArticlePage that uses the imagedataobjectmanager for images. What I'm trying to do is to show the first image in the ArticleHolder, in the Children list of articles.

I've been trying different things but can't get the image to show up. First thing I tried was something like this:

function GetFirstImage($num=1){ 
$manager = DataObject::get_one("ArticlePage"); 
return ($manager) ? DataObject::get("ArticleBilde", "ArticlePageID = $this->ID", "SortOrder", "", $num) : false;