7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » SimpleHTMLEditorField doesnt use paragraph tags?
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: | 1518 Views |
-
SimpleHTMLEditorField doesnt use paragraph tags?

23 September 2010 at 3:18am
Maybe this is normal, but the SimpleHTMLEditorField I'm using does not generate p tags. It surrounds the text by divs instead, which makes the text entered in this field look different from everywhere else that the normal tinymce wysiwyg field is used.
Anybody know a work around or a fix for this? Here is how I am defining and using the field in the template:
DataObject
class UsedEquip extends DataObject{
static $db = array (
'Name' => 'Varchar(255)',
'Description' => 'HTMLText',
'Material' => "Enum('Mild Steel,Stainless Steel','Mild Steel')",
'Tanks' => 'Text',
'MaterialHandling' => "Enum('Conveyor,Drum,Monorail','Conveyor')",
'URLSegment' => 'Varchar(255)'
);static $has_one = array (
'UsedEquipPage' => 'UsedEquipPage',
'Photo' => 'Image'
);public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name','Name'),
new SimpleHTMLEditorField('Description'),
new DropdownField(
$name = "Material",
$title = "Made From",
$source = singleton('UsedEquip')->dbObject('Material')->enumValues()
),
new TextField('Tanks','No. of Tanks'),
new DropdownField(
$name = "MaterialHandling",
$title = "Material Handling",
$source = singleton('UsedEquip')->dbObject('MaterialHandling')->enumValues()
),
new SimpleImageField('Photo'));
}
function Thumbnail() {
$Photo = $this->Photo();
if ( $Photo ) {
return $Photo->CMSThumbnail();
} else {
return null;
}
}public function onBeforeWrite(){
if($this->Name){
$this->URLSegment = SiteTree::GenerateURLSegment($this->Name);
if($object = DataObject::get_one($this->ClassName, "URLSegment='" .$this->URLSegment
."' AND ID !=".$this->ID)){
$this->URLSegment = $this->URLSegment.'-'.$this->ID;
}
// else {
//$this->URLSegment = SiteTree::GenerateURLSegment($this->ClassName.'-'.$this->ID);
//}
parent::onBeforeWrite();
}
}}
Template Snippet:
<% control IndividualEquip %>
<div id="UsedImage">
$Photo.setWidth(600)
</div>
<div id="Overview" class="typography">
<p>Overview:</p>
<ul>
<li>Name: $Name</li>
<li>Construction: $Material</li>
<li>Material Handling: $MaterialHandling</li>
<li>Number of Tanks: $Tanks</li>
</ul>
</div>
<div id="Description" class="typography">
<p>Description:</p>
$Description
</div><% end_control %>
Thanks!
-
Re: SimpleHTMLEditorField doesnt use paragraph tags?

23 September 2010 at 8:07pm
Just wanted to say I am experiencing this issue also and wondered if there was a fix.
It only seems to happen when you format within the wysiwyg. If my clients paste in raw text from notepad it formats correctly.
-
Re: SimpleHTMLEditorField doesnt use paragraph tags?

23 September 2010 at 8:46pm
Try SimpleTinyMCEField rather than SimpleHTMLEditorField
-
Re: SimpleHTMLEditorField doesnt use paragraph tags?

24 September 2010 at 6:35am
SimpleTinyMCEField was a perfect solution for that problem... Thank you!
| 1518 Views | ||
|
Page:
1
|
Go to Top |


