7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Issues with TestimonialPage.ss & ResourcePage.ss
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 1041 Views |
-
Issues with TestimonialPage.ss & ResourcePage.ss

25 January 2010 at 4:41pm
If anyone can help me out with this dilema that would be appreciated.
I have currently installed the dataobject module and also the swfupload successfully. I have followed the tutorial about ccreating a testimonials page to the dot, and also another one about creating an mp3/flv page on you tube.
The CMS registers the testimonial page and the resources page and allows me to upload the correct file types.
HOWEVER...
When i go to view either of the pages they show up as white screens with nothing on them except the Title of the Page. I am at a loss and can not work out how to fix this?
Any ideas?
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

25 January 2010 at 5:00pm
Probably a PHP syntax error of some sort. Crank up your error reporting.
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 2:28pm
I am unsure if there is any php coding errors but i followed the tutorial and copy pasted the code from there so I think it should be right. This is the code i am using at the moment!
~~~~~~~~~~~~~~~~~~~ Testimonials.php ~~~~~~~~~~~~~~~~~~~~~
<?php
class Testimonial extends DataObject
{
static $db = array (
'Date' => 'Date',
'Author' => 'Text',
'Quote' => 'HTMLText'
);
static $has_one = array (
'TestimonialPage' => 'TestimonialPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new CalendarDateField('Date'),
new TextField('Author'),
new TextareaField('Quote')
);
}
}?>
~~~~~~~~~~~~~~~~~~~ TestimonialsPage.php ~~~~~~~~~~~~~~~~~~~~~~~~~~
<?php
class TestimonialPage extends Page
{
static $has_many = array (
'Testimonials' => 'Testimonial'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Testimonials", new DataObjectManager(
$this,
'Testimonials',
'Testimonial',
array('Date' => 'Date','Author'=>'Author','Quote' => 'Quote'),
'getCMSFields_forPopup'
));
return $f;
}}
class Testimonial_Controller extends Page_Controller {}
?>
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 3:03pm
If you're getting a white screen, you need to turn up your error reporting to find out what's going on. It's hard to troubleshoot an error that you can't see!
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 3:04pm
Sorry, I missed one important thing. You said the title is rendering? Like it just says
"TestimonialsPage"?
If that's the case, you probably haven't created a controller for your page class.
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 4:37pm
How do I create a controller?
Do I simply add <code> class Resource_Controller extends Page_Controller {} </code>
And is that the same for the Resources.php and also the ResourcesPage.php or do i need to change it a bit?
ie. <code> class ResourcePage_Controller extends Page_Controller {} </code>
I have a fairly basic understanding of PHP coding so this is taking me a while.
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 4:57pm
Yeah, it can be empty, like you have it, but your naming convention is wrong. Your controller is named TestimonialController, but it needs to match the model that it is controlling, which in your case is TestimonialPage. Controllers need to be named [ModelName]_Controller in order for the ModelAsController class to find the correct controller and template to use. So what you want is:
class TestimonialPage_Controller extends Page_Controller {}
-
Re: Issues with TestimonialPage.ss & ResourcePage.ss

27 January 2010 at 5:21pm
Does this need to be on both the TestimonialPage and the Testimonial php files?
Or do I need to change them to reflect the page name ie:
class TestimonialPage_Controller extends Page_Controller {}
class Testimonial_Controller extends Page_Controller {}
class ResourcePage_Controller extends Page_Controller {}
class Resource_Controller extends Page_Controller {}
When I added in the above to the php files i get an error
XML Parsing Error: XML or text declaration not at start of entity
Location: http://dev.cjtdesign.com.au/silverstripe-v2.3.4/resourcepage/
Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^
| 1041 Views | ||
| Go to Top | Next > |

