Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I am trying to insert a Gallery Macro in Richtext programmatically, but the maco will not render until I Save and Publish the node in the backend:
I do something like this:
----------------
private const string MediaGallery = @"<div umb_macroalias=""macro.Gallery"" umb_media=""{0}"" ismacro=""true"" onresizestart=""return false;"" umbversionid=""{2}"" umbpageid=""{1}"" title=""This is rendered content from macro"" class=""umbMacroHolder""><!-- startUmbMacro --><span style=""color: green;""><strong>Indsæt galleri</strong><br />No macro content available for WYSIWYG editing</span><!-- endUmbMacro --></div>";
IContent contentnode = CreateNode(); contentService.Save(contentnode);
//Set content to Insert Gallery Macro. Using nodeid and mediafolderId
var macro = string.Format(MediaGallery, mediaFolder.Id, contentnode.Id, contentnode.Version); contentnode.SetValue("content", macro);
var status = contentService.SaveAndPublishWithStatus(contentnode);
-----------------
The trouble seems to be the versionId, since contentService.SaveAndPublishWithStatus will set a new versionId.
How can my task be accomplished?
Jes
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Inserting a macro in Richtext, Umbraco 6.2.4
Hi
I am trying to insert a Gallery Macro in Richtext programmatically, but the maco will not render until I Save and Publish the node in the backend:
I do something like this:
----------------
private const string MediaGallery = @"<div umb_macroalias=""macro.Gallery"" umb_media=""{0}"" ismacro=""true"" onresizestart=""return false;"" umbversionid=""{2}"" umbpageid=""{1}"" title=""This is rendered content from macro"" class=""umbMacroHolder""><!-- startUmbMacro --><span style=""color: green;""><strong>Indsæt galleri</strong><br />No macro content available for WYSIWYG editing</span><!-- endUmbMacro --></div>";
IContent contentnode = CreateNode();
contentService.Save(contentnode);
//Set content to Insert Gallery Macro. Using nodeid and mediafolderId
var macro = string.Format(MediaGallery, mediaFolder.Id, contentnode.Id, contentnode.Version);
contentnode.SetValue("content", macro);
var status = contentService.SaveAndPublishWithStatus(contentnode);
-----------------
The trouble seems to be the versionId, since contentService.SaveAndPublishWithStatus will set a new versionId.
How can my task be accomplished?
Jes
is working on a reply...