publishing nodes in code doesn't seem to update the cache properly
Hi!
I have a website with a number of nodes that have child nodes. The main node has a property called "version" and depending on which of the child nodes are published this version number needs to be updated. This version is then included in some xml that is created via xslt.
I am using events to do this as follows..
Document.BeforePublish += new Document.PublishEventHandler(Document_BeforePublish); void Document_BeforePublish(Document sender, PublishEventArgs e) { switch (sender.ContentType.Alias) { case "NodeImLookingFor": //load the document with version property Document doc= new Document(sender.parentId); //the document needed is usually the parent, this has just been condensed down for demonstration purposes //grab the current version number int newVersionNumber = Convert.ToInt32(trail.getProperty("version").Value) + 1; //update the version nyumber doc.getProperty("version").Value = newVersionNumber;
If I then look in the backend to the property it has been updated, but if I use this property in my xslt it doesn't see it as being updated. The only way to get it to update is to publish the parent node directly! I have got caching turned off on the macro and can't think of what else I need to do? What am I doing wrong?
publishing nodes in code doesn't seem to update the cache properly
Hi!
I have a website with a number of nodes that have child nodes. The main node has a property called "version" and depending on which of the child nodes are published this version number needs to be updated.
This version is then included in some xml that is created via xslt.
I am using events to do this as follows..
The only way to get it to update is to publish the parent node directly!
I have got caching turned off on the macro and can't think of what else I need to do?
What am I doing wrong?
Hi Bex,
Just our of curiosity, have you tried to call the document.Save() method before calling the publish() method? :)
is working on a reply...