Hi, I posted this on the google group too.
I'm building my first Silverstripe powered website for a corporate site. I am really enjoying the ease and speed of development, but I've hit a snag: for one page subclass the generated html is missing the stylesheets in the head and menu elements in 'control Menu' template tags.
Page is called 'DocumentsGroup.php':
class DocumentsGroup extends Page {
static $db = array();
static $has_many = array(
'Documents' => 'Document'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new HasManyComplexTableField(
$this,
'Documents',
'Document',
array(
'DocName' => 'Document Title',
'DocPublishDate' => 'Release Date'
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'A Document' );
$fields->addFieldToTab( 'Root.Documents', $tablefield );
return $fields;
}
}
class DocumentsGroup_controller extends Page_Controller {
function init() {
parent::init();
}
}
Document is a DataObject - Document.php looks like:
class Document extends DataObject {
static $db = array(
'DocName' => 'Text',
'DocDescription' => 'Text',
'DocPublishDate' => 'Date',
);
static $has_one = array(
'MyDocumentGroup' => 'DocumentsGroup',
'DocFile' => 'File'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'DocName', 'Document Title' ) );
$fields->push( new TextareaField( 'DocDescription', 'Description') );
$fields->push( new CalendarDateField( 'DocPublishDate', 'Release Date') );
$fields->push( new FileIFrameField( 'DocFile', 'Upload Document' ) );
return $fields;
}
}
In my Page.php, I'm using the Requirements::themedCSS calls to include stylesheets. For normal 'pages' and a couple of other page subclasses I have created, this is working fine. For some reason, this particular page type is ditching the CSS and menu items.
Ie, this:
<ul>
<% control Menu(1) %>
<li class="$LinkingMode"><a href="$Link" title="Go to $Title.XML">$MenuTitle</a></li>
<% end_control %>
</ul>
Just generates as
<ul></ul>
regardless of where in the sitetree the page is, or how many children/siblings/parents the node has.
Any clues? Thanks in advance!