I'm trying to create a link... I've created a new document type, and added a link text property. Within my template I'm getting these objects fine, but the link does not work (the links are appearing on the page):
@foreach(var child in @DynamicModel.Children)
{
<h1>linkText </h1>
<a href="/@child.pdf">@child.linkText</a>
}
In umbraco 4, there were library helpers, and I think this would have worked:
@umbraco.library.NiceUrl(child.pdf )
but this is not working.
I see the uploaded file within the cms, and follow the link.. it goes to:
library urls / links in umbraco 5
I'm trying to create a link... I've created a new document type, and added a link text property. Within my template I'm getting these objects fine, but the link does not work (the links are appearing on the page):
@foreach(var child in @DynamicModel.Children)
{
<h1>linkText </h1>
<a href="/@child.pdf">@child.linkText</a>
}
In umbraco 4, there were library helpers, and I think this would have worked:
@umbraco.library.NiceUrl(child.pdf )
but this is not working.
I see the uploaded file within the cms, and follow the link.. it goes to:
http://localhost/Content/Media/89ffb6e6704a4ce5bd2cd5784b56bc5a/lesson-plan-ks3.pdf
however the page link (from code above) goes to:
http://localhost/media$empty_root$$_p__nhibernate$_v__guid$_3b6fb6f6b36e4b0babf49ff00107ffb7
I'm trying to link to a new media type called "pdf" type which is setup in the media section.
Any help appreciated.
Thanks
... Just got the answer... it is:
var pdfURL = Umbraco.GetMediaUrl(child.pdf, "uploadedFile");
<a href="@pdfURL">@child.linkText</a>
Thank you Mr Buckley
https://gist.github.com/1706821
is working on a reply...