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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Im making a Holder with 2 children pages


Go to End


4 Posts   1332 Views

Avatar
Webdoc

Community Member, 349 Posts

14 February 2010 at 9:47am

But it gives error
in page i need field for height, weight, picture, video link, and the name
have made them using article holder and article page tutorial but something goed wrong.

The pages are called : ElevantPage.php , DigisilmPage.php
and holder name is: KaameraHolder.php

Codes Are

Digisilmpage.php :
<?php
/**
* Defines the ElevantPage page type
*/
class DigisilmPage extends Page {
static $db = array(
'Video' => 'Text',
'Pealkiri' => 'Text',
'Photo' => 'Image',
'Pikkus' => 'Text',
'Korgus' => 'Text'
);
static $has_one = array(
);
}

class DigisilmPage_Controller extends Page_Controller {

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new TextField('Video'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Pealkiri'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new ImageField('Photo'), "Content");
$fields->addFieldToTab('Root.Content.Main', new TextField('Pikkus'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Korgus'), 'Content');

return $fields;
}

}

?>

ElevantPage.php:
<?php
/**
* Defines the ElevantPage page type
*/
class ElevantPage extends Page {
static $db = array(
'Video' => 'Text',
'Pealkiri' => 'Text',
'Photo' => 'Image',
'Pikkus' => 'Text',
'VideoKorgus' => 'Text'

);
static $has_one = array(
);
}

class ElevantPage_Controller extends Page_Controller {

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new TextField('Video'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Pealkiri'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new ImageField('Photo'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Pikkus'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Korgus'), 'Content');

return $fields;
}

}

?>

And the holder page is

<?php
/**
* Defines the ArticleHolder page type
*/
class KaameraHolder extends Page {

static $allowed_children = array("DigisilmPage", "ElevantPage");
}

class KaameraHolder_Controller extends Page_Controller {

}

?>

Avatar
Willr

Forum Moderator, 5523 Posts

14 February 2010 at 2:04pm

Your getCMSFields should be in the model class, not the controller. Thats 1 issue but it shouldn't throw an error. Put your site in devmode and post the actual error message you get it, it'll be quite helpful?

Avatar
Webdoc

Community Member, 349 Posts

14 February 2010 at 5:11pm

found the second problem also it was in db the photo it needed to be in has one.

Avatar
Webdoc

Community Member, 349 Posts

14 February 2010 at 7:48pm

Is there a way to add in the code dataobject htmlfield where i can insert the embed code.