Using Silverstripe CMS, I have a homepage that will have a listing of
featured 'projects':
class HomePage extends Page {
...
static $has_many = array('Projects' => 'Project');
...
function getCMSFields() {
...
$projectsField = new HasManyComplexTableField( $this, 'Projects',
array('Title'=>'Project'), 'getCMSFields_forPopup');
$fields->addFieldToTab('Root.Content.Projects');
...
}
}
class Project {
...
static $has_one = array('HomePageListing' => 'HomePage');
...
}
So far, so good. I can edit the relationship in the CMS.
When I try to iterate over the elements in this has_many relationship,
though, I am unable. In my view if I place <% control Projects %>...<%
end_control %>, nothing happens. Similarly, if I place <% if Projects
%>...<% end_if %> somewhere, the block is never branched into.
Thanks for any help.
Cheers
tdoc
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]