Hi,
I am modifying the StaffHolder.php, as instructed in the second tutorial, so that it shows the complete images and content of StaffPages WITHOUT displaying any StaffPages in the menu under the Staff section on the the webpage. I've gotten SS to show the full content of each child StaffPage in the main staffholder page, but not the attached staff image for each entry. I suspect it has something to do with how I have stated the dataobject::get function in the StaffHolder_Controller, which is currently:
public function GetStaffPage(){
return DataObject::get("StaffPage");
It pulls the $Content from each staffpage but not its associated $Photo image?
See code below for more details,
Thanks the help,
Sam Miller
StaffHolder.php
<?php
class StaffHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('StaffPage');
}
class StaffHolder_Controller extends Page_Controller {
public function GetStaffPage(){
return DataObject::get("StaffPage");
}
}
?>
--------------
StaffPage.php
<?php
class StaffPage extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
return $fields;
}
static $defaults = array(
'ShowInMenus' => false
);
static $allowed_children = array('none');
}
class StaffPage_Controller extends Page_Controller {
}
?>
----------
StaffHolder.ss
<div id="entry_content" class="entry_wide">
<div class="typography">
<h2>$Title</h2>
$Content
<ul id="StaffList">
<% control GetStaffPage %>
<li>
<div class="staffname"><p>$Title</p></div>
<div class="staffphoto">$Photo.SetWidth(150)</div>
<div class="staffdescription"><p>$Content</p></div>
</li>
<% end_control %>
</ul>
</div>
</div>