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

Problem with SS 2.3 add class


Reply


369 Views

Avatar
anackiy.aleksandr

Community Member, 3 Posts

26 June 2012 at 12:49am

Hi! Sorry for my English) I want create new page type.
This is my code
<?php

class VitrinaHolder extends Page {
static $db = array(
"Phone" => "Varchar(200)"
);
static $has_one = array(
);

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField("Phone", "Phone"), "Content");
return $fields;
}
}

class VitrinaHolder_Controller extends Page_Controller {
public function init() {
parent::init();
}
}

?>

I get an error

[User Error] Couldn't run query: CREATE TABLE `VitrinaHolder` ( `ID` int(11) not null auto_increment, `Phone` varchar(200) character set utf8 collate utf8_general_ci, primary key (ID) ) TYPE=MyISAM You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 7
GET /dev/build?flush=1

Line 401 in /home/webzabota/data/www/anackiy.webzabota.com/sapphire/core/model/MySQLDatabase.php

As far as I understand it, the code - is correct. What is the cause of the error? Someone tell me what's the problem?

Attached Files