Hi Guys
I am missing something really basic here, just can not see it
I have created a showcaseholder ,using dataObjectManager and this works perfectly.(1st time using this)
I am now trying to pull the latest image onto the home page and keep getting the error message "Line 21 in /home/stagton/public_html/mysite/code/HomePage.php"
this is line 21 of HomePage.php
return ($latestportfolio) ? DataObject::get("Portfolio", "ParentID = {$portfolio->ID}", "", "", $num) : false;
If you can debug this for me it would be great
thanks
Craig
here is my code
ShowcaseHolder.php
<?php
/**
* Defines the
*/
class ShowcaseHolder extends Page {
static $has_many = array (
'Portfolios' => 'Portfolio'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Portfolios', // Source name
'Portfolio', // Source class
'PortfolioPhoto', // File name on DataObject
array(
'BusinessName' => 'Business Name',
'DomainName' => 'Domain Name'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$manager->setAddTitle("Image");
$f->addFieldToTab("Root.Content.Portfolio",$manager);
return $f;
}
}
class ShowcaseHolder_Controller extends Page_Controller {
public function init() {
parent::init();
Requirements::themedCSS("lightbox");
Requirements::javascript("mysite/javascript/jquery.lightbox-0.5.js");
Requirements::javascript("mysite/javascript/custom.litebox.js");
}
}
?>
portfolio.php
<?php
class Portfolio extends DataObject{
static $db = array(
'BusinessName' => 'Text',
'DomainName' => 'Text'
);
static $has_one = array(
'PortfolioPhoto' => 'Image',
'ShowcaseHolder' => 'ShowcaseHolder',
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('BusinessName','Business Name'),
new TextField('DomainName','Domain Name')
);
}
}
?>
?php
/**
* Defines the ArticlePage page type
*/
class HomePage extends Page {
static $db = array(
);
static $allowed_children = array('SliderPage');
}
class HomePage_Controller extends Page_Controller {
function ShowPortfolio ($num=1){
$latestportfolio = DataObject::get("Portfolio");
return ($latestportfolio) ? DataObject::get("Portfolio", "ParentID = {$portfolio->ID}", "", "", $num) : false;
}
public function init(){
parent::init();
Requirements::themedCSS("slider");
Requirements::javascript("mysite/javascript/jquery.cycle.all.2.74.js");
Requirements::javascript("mysite/javascript/slider.js");
}
}
?>