7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » basic intro please..
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 873 Views |
-
basic intro please..

17 July 2009 at 11:27am
... Hi folks, I'm an ancient programmer who's trying to get their head around the DOM stuff.
What I'm trying to do it to display a web page that shows the local tide tables for a week/month,etc. I've got the data in a local database table, but am facing a really steep learning curve getting started. Can anyone point me to a real basic first couple of steps intro... the one in the stickies sort of didn't get me on the right track unfortunately?
I really would be grateful!
Cheers,
Steve
-
Re: basic intro please..

17 July 2009 at 6:44pm
Hi Steve
What are you trying to achieve? Do you want your data to be editable inside the CMS and therefore you need the DOM?
If you just need to access the data for the front-end, you could write methods in your controller class that get the data from your db table using a simple SQL query. Or use the SilverStripe SQLQuery object: http://doc.silverstripe.com/doku.php?id=sqlqueryBest - Roman
-
Re: basic intro please..

31 July 2009 at 12:31pm
Hi Roman,
Sorry for the delay... this is stuff I'm doing for fun, and the bills got in the way! I'd like the ability to display a week or months worth of info, starting from today, but to have the ability to scroll through the data to show next / last week, etc. The problem is that I'm right at the start of the learning curve. I fully understand what the page you've pointed me to is doing, but not how to get from there to a working web page ):
The other problem is that I've been developing for 30 or so years, and need to re-learn stuff to get my head around these new techniques - the advantages are obvious even to a dinosaur like me!
Cheers,
Steve
-
Re: basic intro please..

31 July 2009 at 8:10pm
Hi Steve
I'm sure you'll get this working. If you didn't read the tutorials already, I suggest you start there: http://doc.silverstripe.com/doku.php?id=tutorial:1-building-a-basic-site
That should give you enough information to build a basic site.
After that, you'll probably want to create a special "TidePage" to display your data. As far as I can tell from your description, you don't need to modify the data in the Backend, so all you have to do is create a method in the "TidePage_Controller" that pulls the data for you. In pseudo code:public function TideData(){
query database for tide data
return data as DataObjectSet
}In the template (TidePage.ss), you can then output the data like this:
<% control TideData %>
<div class="tideData">
html code for each individual TideData entry.
Here you can access the DB fields using $FieldName
</div>
<% end_control %>As a first step (after completing the tutorials and creating a "TidePage" or similar), I'd try a simple query to get some data from the tide-table:
public function TideData(){
$sqlQuery = new SQLQuery();
$sqlQuery->select = array(
// list fieldnames here
);
$sqlQuery->from = array('TideTableName');
$sqlQuery->limit = '10';
return $sqlQuery->execute();
}Once that is working, you can refine that sql statement to only return data sets for a given time-period. For user-interaction, you could use url query strings to get specific data-sets.
| 873 Views | ||
|
Page:
1
|
Go to Top |


