Hi
I'm using DataObjectManager with SimpleTreeDropDownField to select Pages
<?php
class ModulBoxy extends DataObject {
static $db = array (
'Nazwa' => 'Varchar'
);
static $has_one = array (
'Strona' => 'Strona',
'Page' => 'SiteTree'
);
public function getCMSFields_forPopup() {
return new FieldSet(
new TextField('Nazwa','Nazwa:'),
new SimpleTreeDropdownField('PageID', 'Select Page:', 'SiteTree')
);
}
}
?>
Strona.php
public static $has_many = array(
'ModulBoxy' => 'ModulBoxy'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$manager_boxy = new DataObjectManager(
$this,
'ModulBoxy',
'ModulBoxy',
array(
'Nazwa' => 'Nazwa',
'PageID' => 'Page'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab("Root.Content.BoczneBoxy",$manager_boxy);
return $fields;
}
In Templete i get the values like:
Stona.ss
<% control ModulBoxy %>
$Page.Title
<% end_control %>
but if i want to do an IF condition the site is braking down
<% if Page.ClassName == Faq %>
do A function
<% end_if %>
it is so strange, in the next steps i have to do this
<% if Page.ClassName == Faq %>
<% include BoxFaq %>
<% end_if %>
<% if Page.ClassName == Contact %>
<% include BoxContact %>
<% end_if %>
BoxFaq.ss
<% control ModulFaq %> // another DataObjectManager with ImageGallery
$Title
<% control Attachment %>
%Title
<% end_control %>
<% end_control %>