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.
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
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?
@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: