3214 Posts in 848 Topics by 810 members
| Go to End | ||
| Author | Topic: | 1248 Views |
-
Re: Multiple ||

25 October 2009 at 2:14pm
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.
-
Re: Multiple ||

25 October 2009 at 2:20pm
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; -
Re: Multiple ||

25 October 2009 at 2:26pm
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.
-
Re: Multiple ||

25 October 2009 at 3:14pm
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 Referralsfunction 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 ReferralsCreated 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
-
Re: Multiple ||

25 October 2009 at 4:23pm
Since this is in your decorator you have to refer to fields as $this->owner->Referrals.
-
Re: Multiple ||

25 October 2009 at 7:41pm
Thank you very much. Really appreciate your support especially on a Sunday
Cheers
Catherine
| 1248 Views | ||
| Go to Top |

