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
I don't know where else to put this I'm afraid; I made a modification to your code to allow it to read dates from XML properties as used in PDCalendar; it is a simple change that adds the ability to read an XPath from the config, e.g.
<add key="itemDateProperty" value="testDate/pdcalendarevent/pdcstart"/>
The XPath is a bit of a cheat; the first element is the property alias, then the rest is the XPath for the XML contained in that property.
public static string GetPropertyValueAsString(this UmbracoDocument document, string propertyAlias) { String res = String.Empty; // Get alias type = name or name / path String path = null; Match m = Regex.Match(propertyAlias, @"^([\w\d_]+?)(/.+)$"); if (m.Success) { propertyAlias = m.Groups[1].Value; path = m.Groups[2].Value; } // umbraco.cms.businesslogic.property.Property prop = document.getProperty(propertyAlias); if (prop != null) { if (path != null) { XmlDocument doc = new XmlDocument(); XmlNode np = prop.ToXml(doc); if (np != null) { XmlNode nv = np.SelectSingleNode(path); if(nv != null) res = (nv is XmlElement ? nv.InnerText : nv.Value); } } else if(prop.Value != null) res = prop.Value.ToString(); } return res; }
I guess this is the correct spot to post this. The only fault you've made is posting it twice :P
Yes, I don't know what happened there! I tried to delete it twice! I'll give it another go now :o)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Loading from XML properties (e.g. PDCalendar)
I don't know where else to put this I'm afraid; I made a modification to your code to allow it to read dates from XML properties as used in PDCalendar; it is a simple change that adds the ability to read an XPath from the config, e.g.
The XPath is a bit of a cheat; the first element is the property alias, then the rest is the XPath for the XML contained in that property.
I guess this is the correct spot to post this. The only fault you've made is posting it twice :P
Yes, I don't know what happened there! I tried to delete it twice! I'll give it another go now :o)
is working on a reply...