Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Publish method doesn't have the desired effect


Go to End


2 Posts   1102 Views

Avatar
Jakx

Community Member, 3 Posts

13 February 2014 at 2:31pm

Edited: 13/02/2014 3:02pm

Within SS 3.1.1, when I use:

$Page->writeToStage("Stage");
$Page->publish("Stage", "Live");

This doesn't seem to produce a published version of the page, only a draft version.

Changes made, that are noticeable within the CMS, aren't being picked up at the front end. For example: If a $has_one relationship ID is changed; that relationship does not call the correct value via template but it's value behaves correctly while viewing the page in the CMS.

Only when you click the "Published" button in the CMS does the change take effect at the front end.

Is there any explanation for this?

Avatar
Willr

Forum Moderator, 5523 Posts

15 February 2014 at 10:41pm

Try just write(). Should still work I would imagine. Here's a reference - https://github.com/silverstripe/silverstripe-cms/blob/3.1/code/model/SiteTree.php#L1419