Hi,
I have a PersonsHolder with several PersonsPage-children. With a dropdown ('Show' => "Enum('Featured,Standard,Do not show','Standard')") in PersonsPage it is decided how the childpage is shown in the PersonsHolder.
To accomplish this, I would like to create a custom controller. Based on the second tutorial and this post I wrote:
class PersonsHolder_Controller extends Page_Controller{
...
function Accent() {
return DataObject::get("PersonsPage","Show = Standard");
}
}
In PersonsHolder.ss I call this control like this:
<% control Accent %>
<a href="$URLSegment">$Title</a>
<% end_control %>
However... I get the following error:
[User Error] Couldn't run query: SELECT `SiteTree_Live`.*, `Page_Live`.*, `PersonsPage_Live`.*, `SiteTree_Live`.ID, if(`SiteTree_Live`.ClassName,`SiteTree_Live`.ClassName,'SiteTree') AS RecordClassName FROM `SiteTree_Live` LEFT JOIN `Page_Live` ON `Page_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `PersonsPage_Live` ON `PersonsPage_Live`.ID = `SiteTree_Live`.ID WHERE (Show = Standard) AND (`SiteTree_Live`.ClassName IN ('PersonsPage')) AND (`SiteTree_Live`.SubsiteID IN (0)) AND (`SiteTree_Live`.SubsiteID IN (0)) ORDER BY Sort You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Show = Standard) AND (`SiteTree_Live`.ClassName IN ('PersonsPage')) AND (`SiteT' at line 1
GET /ss/new-personsholder/
Line 394 in C:\wamp\www\ss\sapphire\core\model\MySQLDatabase.php
What am I doing wrong? (I did run db/build several times)