Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SilverStripe Book Chapter 5 Error


Reply


3 Posts   379 Views

Avatar
weisdaclick

Community Member, 21 Posts

6 March 2012 at 12:13am

Edited: 06/03/2012 12:14am

I have seen this issue posted around the board and I have followed the steps taken to rectify it but nothing seems to work.

I have also downloaded the sample code from the Wiley website, this example is not in it - disappointing.

I am trying to learn SilverStripe and following the SilverStripe Complete Guide To CMS Development by Wiley - Chapter 5 Job postings which tells the reader:

Create a file named JobCategoryHolder.php

<?php
class JobCategoryHolder extends Page {
static $allowed_children = array(
'JobCategory'
);
static $singular_name = 'Job category overview';
static $plural_name = Job category overviews'; - surely a missing ' in this line?
}
class JobCategoryHolder_Controller extends Page_Controller {
}
?>

Create a file named JobCategory.php in the mysite/codefolder:

<?php
class JobCategory extends Page{
static $singular_name = 'Job category';
static $plural_name = 'Job categories';
}
class JobCategory_Controller extends Page_Controller {}
?>

Please create a file called Job.php in the mysite/code folder:

<?php
class Job extends DataObject {
}
?>

I have to say the book is quite confusing and not very well written at this point, there seems to be an obvious (even to me) error in the first JobCategoryHolder.php file - a missing quote.

If anyone has got this working can you let me know what I need to do or where to look to get this working.

Avatar
swaiba

Forum Moderator, 1805 Posts

6 March 2012 at 1:47am

Hi,

https://github.com/chillu/silverstripe-book

has the code stored and answers the question about what to do on that page (in the readme bit)

Avatar
weisdaclick

Community Member, 21 Posts

6 March 2012 at 9:27am

Thanks buddy, will check it out.