21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 690 Views |
-
Im making a Holder with 2 children pages

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.phpCodes 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 {
}
?>
-
Re: Im making a Holder with 2 children pages

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?
-
Re: Im making a Holder with 2 children pages

14 February 2010 at 5:11pm
found the second problem also it was in db the photo it needed to be in has one.
-
Re: Im making a Holder with 2 children pages

14 February 2010 at 7:48pm
Is there a way to add in the code dataobject htmlfield where i can insert the embed code.
| 690 Views | ||
|
Page:
1
|
Go to Top |


