depends on your context though... not sure on the behind the scenes.. but I'd say that umbraco.library.NiceUrl(int Id) was an older way of doing things taken from .net usercontrols... and I'd think the below were more "Razor", also not sure which ones might inadventently hit the database :-)
Razor version of nicurl to get url from id in template
What is the razor equivalent of this?
I've tried @umbraco.Url(1234) and various others with no luck. Am I missing something simple here?
Here it is! @Umbraco.NiceUrl(1234)
You can make use of
depends on your context though... not sure on the behind the scenes.. but I'd say that umbraco.library.NiceUrl(int Id) was an older way of doing things taken from .net usercontrols... and I'd think the below were more "Razor", also not sure which ones might inadventently hit the database :-)
eg
So, is there a way to get a path to an image in the same way?
http://our.umbraco.org/Documentation/Reference/Management-v6/Models/Media for the latest v6 MediaService stuff... (not moved onto it yet as we're still v4.11 and webforms with razor)
but pre v6..
there is a Library.MediaById(1234).umbracoFile that would give you the url to the image.
Infact this might be for you too.. the latest and greatest in v6 MVC.
http://our.umbraco.org/documentation/Reference/Mvc/querying
Thanks Mike! I always forget that we have good documentation now on Our, here's what did it for me: @Umbraco.Media(1841).Url
is working on a reply...