17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1067 Views |
-
Tutorial 2 - Date / Author Not Saving

20 September 2008 at 7:23am
While working through tutorial 2 I was able to add the Date and Author the the main tab in ArticlePage and get it to show up in the tab itself. But when I create the news story and save or publish, the data for the added fields Date and Author did not save properly though the rest of the content did.
My ArticalePage.php:
<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);static $has_one = array(
);function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');return $fields;
}
}class ArticlePage_Controller extends Page_Controller {
}
?>I'm doing this in my site and this file lives in mysite/code directory.
Is there something small / obvious that I'm missing? The best I can tell my code is basically verbatim from the tutorial.
Cheers,
Craig
-
Re: Tutorial 2 - Date / Author Not Saving

20 September 2008 at 7:46am
OK, so what seemed like the 50th time I did /db/build and it finally created the tables.
So my question now is - is there a difference between /db/build/?flush=1 and simply /db/build?
If both are valid, when is each appropriate?
-
Re: Tutorial 2 - Date / Author Not Saving

20 September 2008 at 9:24am
I always use db/build?flush=1. Flushing does a bunch of extra stuff, and generally if you've changed your classes you need to flush.
-
Re: Tutorial 2 - Date / Author Not Saving

20 September 2008 at 9:28am
That's interesting as /db/build/?flush=1 was how I was doing it, but it wasn't until I only did /db/build were the new tables added to the database. I'll watch more closely the next time I do this. Only my 2nd day working with SS, but to this point like what I see over all.
| 1067 Views | ||
|
Page:
1
|
Go to Top |


