Hi,
I love to use Silverstripe for small projects. This backend is so easy to use, that none of my customers had ever any problems using it. :)
But now I´m working on a bigger website with multiple content blocks. So I followed the Extending a basic site tutorial, but something doesn´t work properly.
Since I want pages with content blocks, I made a new file under /mysite/code named BlockPage.php:
<?php
class BlockPage extends Page {
static $db = array(
'2ndRowLeft' => 'HTMLText',
'2ndRowRight' => 'HTMLText'
);
static $has_one = array(
);
/**
* Additional Content Blocks
*/
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('2ndRowLeft'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('2ndRowRight'), 'Content');
return $fields;
}
}
class BlockPage_Controller extends Page_Controller {
}
?>
Of course I ran "/dev/build"
It works very good. I have two new editor fields, PhpMyAdmin shows the new tables and I can insert HTML into the DB (however, I don´t know how to put them AFTER "Content". Do I have to combine "addFieldToTab" with "insertAfter"? - But this is not the worst problem)
To display this two blocks on my BlockPage-type pages I made a copy of .../templates/Layout/Page.ss, called it BlockPage.ss and inserted $2ndRowLeft and $2ndRowRight:
<div class="typography">
<% if Menu(2) %>
<% include SideBar %>
<div id="Content">
<% end_if %>
<% if Level(2) %>
<% include BreadCrumbs %>
<% end_if %>
<h2>$Title</h2>
$Content
$Form
<div class="2ndRowLeft">$2ndRowLeft</div>
<div class="2ndRowRight">$2ndRowRight</div>
<% if Menu(2) %>
</div>
<% end_if %>
</div>
But Silverstripe doesn´t display the HTML I inserted using my new editor fields. All I can see on the page are the variables "$2ndRowLeft" and "$2ndRowRight".
Did I miss anything?
/edit: Oh yes, I flushed it ;)