5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 994 Views |
-
HtmlEditorField editor field not displaying content in page

29 January 2009 at 9:17am
I've seen a few other posts with this problem, but no real solution and I'm really beginning to pull my hair out. I've added a second HtmlEditorField editor field to the CMS for entering testimonials, but the content that is added in the cms doesn't display in the web page.
My .php page is as follows:
class CoursesPage extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image',
'Testimonials' => 'HTMLText'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('Testimonials', 'Add Testimonials'));
return $fields;
}
}class CoursesPage_Controller extends Page_Controller {
}My .ss is as follows:
<div id="Testimonials" style="float: right; width: 180px; border: 1px solid #ccc">
$Testimonials
</div>I've flushed and rebuilt but to no avail. The Image tab show above does however work ok.
PLEASE HELP!
-
Re: HtmlEditorField editor field not displaying content in page

29 January 2009 at 10:24am
HTMLText is a database field, not a relation, so change this:
class CoursesPage extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image',
'Testimonials' => 'HTMLText'
);to...
class CoursesPage extends Page {
static $db = array(
'Testimonials' => 'HTMLText'
);
static $has_one = array(
'Photo' => 'Image',
); -
Re: HtmlEditorField editor field not displaying content in page

29 January 2009 at 10:59pm
THANK YOU! That works now, still trying to get my head round how this all works.
(BTW for anyone who might be looking at this and still getting to grips with php there shouldn't be a comma after 'Photo' => 'Image' as shown below, this will throw an error)
| 994 Views | ||
|
Page:
1
|
Go to Top |


