Suppose I have the following function (in Page.php):
function showMensSweaters() {
$whereStatement = "MenCat = 1 AND SweaterCat = 1";
return DataObject::get("Page", $whereStatement);
}
When I call it in a template with a control block, like so (simplified html for readability):
<% control showMensSweaters %>
<a href="$Link" title="View style {$MenuTitle.XML}">$Photo.SetWidth(108)</a>
<% control Styles %>
<p>$StyleNumber</p>
<% end_control %>
<% end_control %>
it all works. The pages for which the booleans MenCat and SweaterCat are true, are iterated over and rendered. Also, the "Styles" block is included for those pages where a Style is "attached" with a many-many relationship. All is good.
But if I change the whole thing in such a way, that one of the variables for the function is not a boolean but, say, of the text type, like so (and of course change all the associated code accordingly, in how the variables are set in the CMS etc.):
function showMensSweaters() {
$whereStatement = "MenCat = 1 AND SweaterCat = bigsweater";
return DataObject::get("Page", $whereStatement);
}
the thing blows up: the template doesn't render at all. What do I have to do to make that kind of thing work?
Thanks in advance!
(edit: added correct 'code' tags)