我試圖使用調用外部API的後臺進程將頁面添加到Silverstripe站點樹。如何以編程方式向Silverstripe添加新頁面?
我只是想讓代碼創建一個新的程序頁權利。目前我有:
$mySiteTree = new SiteTree();
$mySiteTree->ClassName = "Programme";
$mySiteTree->URLSegment = $newurl;
$mySiteTree->URLSegment = 'testurl';
$mySiteTree->Title = 'testing title';
$mySiteTree->ShowInMenus = '1';
$mySiteTree->ParentID = '86';
$mySiteTree->write();
這似乎並沒有創建任何頁面。任何關於我在做什麼錯的建議,或者我可以嘗試做什麼來調試?
可能重複的[SilverStripe 3.1 - 從FrontEnd頁面創建和發佈](http://stackoverflow.com/questions/21671943/silverstripe-3-1-page-creating-publishing-from-the-frontend) – Zauberfisch
一個類似的問題剛剛被問到了幾天前。請結帳http://stackoverflow.com/questions/21671943/silverstripe-3-1-page-creating-publishing-from-the-frontend - 我建議這是關閉作爲重複 – Zauberfisch
SiteTree,應該是頁面。一個很好的參考是內置的默認記錄.. https://github.com/silverstripe/silverstripe-cms/blob/3.1/code/model/SiteTree.php#L1419 – wilr