5102 Posts in 1520 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2038 Views |
-
Adding Image to Page throws [Warning] Unknown Class from is_subclass_of

7 August 2009 at 5:37am Last edited: 7 August 2009 7:49am
I am following the tutorial and adding an Authors section similar to the Staff page:
http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-siteI have created a holder and custom page type under them. The fields build and add correctly in the CMS, however the Image tab iframe has a caller error that doesn't make sense to me. The PHP call is_subclass_of is throwing a warning that "Unknown class passed as parameter".
This is a bizarre error as the class it is complaining about is finding my AuthorPage class under DataObject. Obviously the AuthorPage class is being included as I can create pages and work with it. Why would the Image type interface be blowing up on this?
Edit: This has been solved, see the second post
Code:
<?php
/*
* This is for individual Author entries
*/
class AuthorPage extends Page {
static $db = array(
'Name' => 'Text'
);static $has_one = array(
'Photo' => 'Image'
);/*
* Add our custom data bits
*/
function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Main', new TextField('Name'), 'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));return $fields;
}
}class AuthorPage_Controller extends Page_Controller {
}
/*
* Holder for all Author Pages
*/
class Authors extends Page {
static $db = array();
static $has_one = array();
static $allowed_children = array('AuthorPage');
}class Authors_Controller extends Page_Controller {
}
?>
Error Trace
Attached -
Re: Adding Image to Page throws [Warning] Unknown Class from is_subclass_of

7 August 2009 at 7:48am Last edited: 7 August 2009 7:49am
I figured this out, it was merely me being stupid.
The way SS works with manifesting it's includes relies on the filename / directory location. I was being lazy and put both the Authors and AuthorPage classes in the same file thinking "its just a plain old require_once somewhere". Wrong!
If you get this error your file and class name do not match somewhere.
| 2038 Views | ||
|
Page:
1
|
Go to Top |

