7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » IF conditions in DataObjectManager
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: | 708 Views |
-
IF conditions in DataObjectManager

27 September 2010 at 11:23pm Last edited: 27 September 2010 11:24pm
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 %>
-
Re: IF conditions in DataObjectManager

28 September 2010 at 2:19am
I'm not really seeing the issue??
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: IF conditions in DataObjectManager

28 September 2010 at 7:29pm
i get blank page
try it yourself, maybe i'm doing something wrong -
Re: IF conditions in DataObjectManager

29 September 2010 at 2:15am
Turn on your PHP error reporting. A blank page isn't very helpful!
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com
| 708 Views | ||
|
Page:
1
|
Go to Top |

