isbel,
here is some c# code that does something similar :
Code:
XPathNodeIterator xn = umbraco.library.GetMedia(1113, false);
xn.MoveNext();
string url = "";
XPathNodeIterator xn2 = xn.Current.Select("data[@alias='umbracoFile']");
xn2.MoveNext()
url = xn2.Current.Value;
I have not tested the above code but i have something similar full code is
Code:
/// <summary>
/// for given node id get the url
/// </summary>
/// <param name="NodeID">NodeID could be node or media</param>
/// <returns></returns>
public static string GetNodeURL(string NodeID) {
int nodeid = int.Parse(NodeID);
string url = umbraco.library.NiceUrl(nodeid);
//assume its media
if (url.Length == 0) {
XPathNodeIterator ni = umbraco.library.GetMedia(nodeid, false);
while (ni.MoveNext())
{
XPathNavigator navCurrent = ni.Current;
url = getURL(navCurrent);
}
}
return url;
}
/// <summary>
/// for media node get url by traversing the data node
/// </summary>
/// <param name="current"></param>
/// <returns></returns>
private static string getURL(XPathNavigator current)
{
// Clone navigator to move off axis.
XPathNavigator member = current.Clone();
string url = "";
XPathNodeIterator xn = member.Select("data[@alias='umbracoFile']");
while (xn.MoveNext())
{
url = xn.Current.Value;
}
return url;
}
hope this helps.
Level 2 certified. If it aint broke dont fix.