Jump to:

23001 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Getting a value from silverstripe database

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1075 Views
  • MagicUK
    Avatar
    Community Member
    60 Posts

    Getting a value from silverstripe database Link to this post

    Hi (again) all. I'm having a really hard time trying to find what I'm looking for on the silverstripe documentation.

    All I'm looking for is how to get a value from the silverstripe database as I would like to display content from another page on the home page.

    If the value I'm looking for was in the 'SiteTree' table on the content column where ID=1.

    How would I run the query? is it using dataobject::get()? I cant find any documentation on it for the syntax.

    Thanks in advance.

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Getting a value from silverstripe database Link to this post

    Yes DataObject::get is the most common way to get info from the database... here is the doc http://api.silverstripe.org/trunk/sapphire/model/DataObject.html#methodget

    Although SS are in the process of moving all the docs at the moment so I don't know how long the link will be valid for!

    I'm often sceptical when people say they cannot find help... I click Help in the menu above, click documentation and then search "DataObject" or select something from the menu - like DataModel - http://doc.silverstripe.org/sapphire/en/topics/datamodel

  • MagicUK
    Avatar
    Community Member
    60 Posts

    Re: Getting a value from silverstripe database Link to this post

    Thanks for the reply swaiba. I've actually been trying to work my way through the documents you have supplied. I think its just my 'newbieness' as I'm having a hard time with them and didn't realise that they will infact give me the answer I'm looking for.

    1075 Views
Page: 1
Go to Top

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

Comments on this website? Please give feedback.