Login | Forgot password | Register

X

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.

Jump to:

1155 Posts in 324 Topics by 274 members

Data Model Questions

SilverStripe Forums » Data Model Questions » public function BlogEntries

Page: 1
Go to End
Author Topic: public function BlogEntries 152 Views
  • Garrett
    avatar
    Community Member
    149 posts

    public function BlogEntries Link to this post

    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

    152 Views
Page: 1
Go to Top

Currently Online: cardinale

Welcome to our latest member: g6

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.