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.

General Questions /

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

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

Database Connectivity


Go to End


4 Posts   1754 Views

Avatar
Grumble

Community Member, 1 Post

15 June 2009 at 5:37pm

Hi. I'm new to CMSs and am choosing one to work with. If you have a good answer to the following question, I'm yours.
Lets say I have a large product database. I want to either:
- load the database into SilverStripe, so I can display it, or
- let SilverStripe read the database, displaying fields on a page, or
- access the source code of a page, so I can insert my own php commands to access the database.
Is any of this possible? If so, how?
Really basic question I would have thought, but I can't find anything about it.

Cheers,
Grumble.

Avatar
Willr

Forum Moderator, 5523 Posts

15 June 2009 at 6:12pm

If you want to interact with the Database you can use the ORM layer - eg to get all the products you can do DataObject::get('Product') which will return a set of Product elements. If you want to bypass that (and sometimes its faster) you can use SQLQuery - http://doc.silverstripe.com/doku.php?id=sqlquery

Avatar
wundabred

Community Member, 1 Post

19 September 2009 at 5:44am

What if I have all of the info I need in the database, but do not know how to CREATE the database? e.g. I am contemplating Silverstripe for my company's CMS and website, and need to create pricing tables for our products. I would like for these tables to be database driven, for ease of updating. Suggestions?

Many thanks,
-
WB

Avatar
dalesaurus

Community Member, 283 Posts

19 September 2009 at 7:50am

@wundabred That is pretty trivial with SS. Once you create your custom DataObject representing your products and build the tables will be created. Next step is to load your data ( pause here... many ways to do this).

The data is easily maintained with the ModelAdmin, which provides full CRUD operations for your tables in a pleasant GUI. It only takes a few lines of code to use it:
http://doc.silverstripe.com/doku.php?id=modeladmin