Can you post your template file - If you are in the control then the scope of the template changes so functions from the Controller won't be called. Thats possibility you're issue.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- Page 22(current)
DirectoryPage.ss
<% control Listings %>
...
<% if Offerings %>
<li>Avaliable <% end_if %>
DirectoryPage.php
function Listings() {
return DataObject::get('Member', "IncludeInDirectory = TRUE AND DirState = '" . $this->title . "'");
}
function getOfferings() {
die('');
return True;
Ah ok that clears things up. Doing <% control Listings %> changes the scope in the template to the 'Member' object rather then the DirectoryPage. To get Offerings to work you need to add that function to your Member decorator (looks like you have decorated it already) so by putting that function in the decorator it should be called.
Hi Will
Thats got it to apply, thanks. But the actually decision making is still not actually working.
function Offerings() {
return ($this->Referrals) ? true : false;
}
Returns false all the time independant of the value of Referrals
function Offerings() {
return (Referrals) ? true : false;
}
Returns True all the time independant of the value of Referrals
function Offerings() {
return ($this->Referrals=="True") ? true : false;
}
Returns false all the time independant of the value of Referrals
Created Referrals as an Enum rather than a Boolean to enable me to align with users administration database.
'Referrals' => "Enum('TRUE,FALSE','FALSE')",
Any ideas what I am doing wrong?
Thanks
Catherine
Since this is in your decorator you have to refer to fields as $this->owner->Referrals.
Thank you very much. Really appreciate your support especially on a Sunday
Cheers
Catherine
- Previous 10 entries
- 1
- Page 22(current)