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.

Data Model Questions /

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

public function BlogEntries


Go to End


2204 Views

Avatar
Garrett

Community Member, 245 Posts

6 May 2009 at 7:45am

Hi,

How is it that using this function, with DataObject::get('Page', etc.), we are able to separate the Tags into individual links on the template level ($Link?tag=$Tag), but if I try to customise the query using DB:query(), all I get back from the BlogEntry table is the Tags column as one solid block?

Because I need to do a couple of JOIN's, I need to use DB:query():

SELECT ST.Title, ST.Content, ST.URLSegment, BE.*, F.FileName AS ListingImage FROM BlogEntry BE
JOIN SiteTree ST ON ST.ID = BE.ID
LEFT JOIN File F ON F.ID = BE.ListingImageID

Then:

foreach($item as $sqlResult) {
$Tags = $sqlResult['Tags'];
Etc.

$results->push(new ArrayData(array(
"Tags" => $Tags,
Etc.
)));

}
return $results;

How can I pass the Tags back pre-split? They're already inside an array. Help!

Thanks,
Garrett