1
我使用下面的代码创建了元标题,但它适用于大多数我的网站,但一个特定的网站不会保存元标题,所以当我编辑时显示我以前输入的标题,相同的代码对于所有的网站,但一个不节约?自定义银条纹元字段不保存
class Page extends SiteTree {
private static $db = array(
'MetaTitle' => 'Varchar(255)'
);
private static $has_one = array(
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TextField::create('MetaTitle')
->setRightTitle('Shown at the top of the browser window and used as the "linked text" by search engines.')
->addExtraClass('help')
, 'MetaDescription');
return $fields;
}
}
你打电话给/ dev/build?flush = 1吗?也许该字段不在你的db中 –
@csy你是正确的,需要dev/buils和flush。 –