Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Blog module doesn't use the standard HTML form?!

Go to End

10 Posts   6704 Views


Community Member, 12 Posts

30 November 2007 at 2:45pm

Edited: 30/11/2007 2:45pm


I just noticed when using the blog module, that it doesn't support the standard HTML text entry (and TinyMCE editing capabilities) of a standard Silverstripe page. Instead, it opts for the insanity of having a BBcode parser?!

My main concern with this is that the TinyMCE controls remain active, and it's very misleading to go and try to insert an image, only to have the JavaScript controls fail in an error because it can't find any target textarea controls to use.

Given that this HTML editing ability seems to be a core part of the Silverstripe system, I would like to know why the blog ignores it and opts for a non-HTML BBcode solution instead? It seems almost counter-productive.

I tried to do a little bit of hacking about to change the textarea from the BBcode one to a standard Silverstripe HTML one, and it worked okay in the admin, but saving resulted in a catastrophic failure which broke the blog posts on the public side.

Is there any possibility that a future release of the blog module could scrap the BBcode and instead just use the HTML controls provided? It'd make life a lot more pleasant, I feel :)


Community Member, 48 Posts

30 November 2007 at 3:27pm

Hi Thanks for raising this - I was just about to enter a similar post

Also I'm wondering why there is an inconsistency when entering links.

If you right click on some highlighted text, and select Insert/Edit text you get a pop-up dialog to enter the details. If instead you click the hyperlink icon on the html toolbar, you get a Link section appear on the right to enter the details.

Plus there are differences - e.g. the pop-up one has a class selection.

regards, Dave Porter
DJ Software


126 Posts

30 November 2007 at 4:09pm

Edited: 30/11/2007 4:22pm


I think the main reason for BBCode is to add/edit blog articles on the published site using the Blog Management Widget. I did not want to do without the comfort of the TinyMCE editor either; I found it quite straightforward to modify the blog module. You probably found out how to change the Textarea field in the CMS to a HTMLEditorField through getCMSFields() in BlogEntry.php:

$fields->addFieldToTab("Root.Content.Main", new HtmlEditorField("Content", "Content", 20));

The paragraph summary that displays a short summary of blog articles in the Blog Holder, however, simply cuts off the text of blog modules. This is OK with BBCode, but with html code it may break the layout of blog posts on a Blog Holder page. So the next thing I modified was to replace the ParagraphSummary() and ParsedContent() methods in BlogEntry.php with:

function ParagraphSummary(){
	return $this->Content;	

function ParsedContent() {
	return $this->Content;

There may be a more efficient way, but I wanted to make as little changes to the original code as possible so a future update of the blog module would be less painful.

- - - - - - - - - - - - - - - - - - - - - - - -
To get the possibility to add a "read more/read the full post" link to the blog summary the easiest way I find is to add another field to the CMS, again in getCMSFields() in BlogEntry.php add this line below all other field definitions:

$fields->addFieldToTab("Root.Content.Main", new HtmlEditorField("ContentMore", "More", 10));

To add the field to the database add "ContentMore" => "Text" to the $db array in BlogEntry.php:

static $db = array(
	"Date" => "Datetime",
	"Author" => "Text",
	"Tags" => "Text",
	"ContentMore" => "Text",

I also added a new function that is useful for the template to the BlogEntry class:

function hasReadMore() {
	if ($this->ContentMore == '' || $this->ContentMore == '<p></p>') {
		return false;
	return true;

You can then use this function in the template, e.g.:

<% if hasReadMore %>
<a href="$Link" title="Read Full Post">Read the full post</a>
<% end_if %>

To display the additional content add the $ContentMore variable to the template, e.g.:


- - - - - - - - - - - - - - - - - - - - - - - -

To clean up the code you can delete or comment the BBCodeHelp fields and any BBCode related lines from both BlogEntry.php and BlogHolder.php and remove the Blog Management Widget ($managementwidget) in the requireDefaultRecords() method in BlogHolder.php

run /db/build/?flush=1 and the blog now hopefully uses the html editor and still provides the functionality of a blog summary. You loose the Blog Management Widget, but I can live with that.

Maybe I forgot a few minor adjustments, but it should be enough information to make it work.



Community Member, 3 Posts

15 March 2008 at 1:07am

Great summary, just one correction. The extra ContentMore field type in the $db array should be 'HTMLText', with no trailing comma:

static $db = array(
"Date" => "Datetime",
"Author" => "Text",
"Tags" => "Text",
"ContentMore" => "HTMLText"


Community Member, 6 Posts

4 April 2008 at 7:09pm

Can someone post their edited and working files mentioned above? It would really help.



Forum Moderator, 5523 Posts

7 April 2008 at 3:16pm

If you don't want to use BBCode and want to revert to using TinyMCE you can add BlogEntry::allow_wysiwyg_editing();


126 Posts

9 May 2008 at 12:44pm

Hi willr,

thank you for that hint. This new option is great!

Please note that as I am writing this you need the latest daily build of the blog module (, not the version in the regular download section.

You may also need to make a little change in the template file, e.g. I am using the Olive Sunset template and had to change
in the file (in the olivesunset_blog section).

A similar change is necessary in the file.


Community Member, 1 Post

20 May 2008 at 12:23am


I'm a fresh new user of SilverStripe (what a great cms!), everything's fine, only one issue with the blog module:

I'm using the latest build of the module (05/18/2008), with the "BlogEntry::allow_wysiwyg_editing('true');" option and the vista theme.
I can add the entry using the html editor, when I view the post on the summary it's displayed ok, but when I try to view the full post (using the "read the full post" button):
the post is displayed with the full html code (without interpreting it).

What (and where) do I need to change the code to make it work?

Thanks a lot for your help,

Go to Top