23479 Posts in 18951 Topics by 2878 members
|Go to End|
29 January 2010 at 5:46am
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.
$pg = new ProductGroup;
$pg->Title = "Test";
$pg->ParentID = 2;
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?
29 January 2010 at 12:17pm
With writing pages you need 2 lines. One to write, the other to sync the stage / live modes
It doesn't have an URLSegment so it's hard to click on and it's uneditable.
So then you probably need to set its URLSegment when you create the object.
29 January 2010 at 1:24pm Last edited: 29 January 2010 1:25pm
Thanks for the reply. The URLSegment is generated automatically so I don't have to set it. It just wasn't working in the Stage table.
I had to reverse Stage and Live in the publish function, as it was going well for the Live bit, but not the Stage bit.
made it work!
|Go to Top|