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。 –