Hi,
I'm trying to add a page to the Sitetree from a controller.
I have ProductGroup which extends Page and I'm able to make ProductGroup pages in the CMS.
My code:
$pg = new ProductGroup;
$pg->Title = "Test";
$pg->ParentID = 2;
$pg->write();
This makes a valid entry in both Sitetree_Live and ProductGroup in the database and I can view that page in the website. It also makes an entry in Sitetree, but with the ClassName SiteTree, no Title and no ParentID (ParentID = 0). It kinda mucks things up in the CMS. The page is there, but in the root and not under node 2. It doesn't have an URLSegment so it's hard to click on and it's uneditable.
Is there any way I can have the Sitetree behave the same as Sitetree_Live?
TIA