I manage to successfully upgrade Umbraco from 4.0.3 to 4.11.10. I have 100's of xslt files in the older version and in umbracoSettings.config file I have used this settting to be "true". Every thing is working except when I wrote a simple razor macro below and noticed @photo.umbracoFile is always null or empty. I found this article http://allan-laustsen.blogspot.co.uk/2012/04/umbraco-razor-dynamicmedia-umbracofile.html but the solution is a bit confusing. I wonder if any one can help on this?
@{
//Check the currentpage has a value in the property 'photos'
if (Model.HasValue("sliderImages"))
{
var MediaFolder = Library.MediaById(Model.sliderImages);
<ul>
@foreach (var photo in MediaFolder.Children)
{
<li>
<img src="@photo.umbracoFile" alt="@photo.Name" />
</li>
}
</ul>
}
}
I'm sorry but Razor in Umbraco doesn't work if you have UseLegacyXmlSchema set to true in the umbracoSettings.config file. For now you can only use xslt or set UseLegacyXmlSchema to false and try to convert your XSLT files with this package: http://our.umbraco.org/projects/developer-tools/xsltupdater-for-umbraco
umbracoFile property empty
I manage to successfully upgrade Umbraco from 4.0.3 to 4.11.10. I have 100's of xslt files in the older version and in umbracoSettings.config file I have used this settting to be "true". Every thing is working except when I wrote a simple razor macro below and noticed @photo.umbracoFile is always null or empty. I found this article http://allan-laustsen.blogspot.co.uk/2012/04/umbraco-razor-dynamicmedia-umbracofile.html but the solution is a bit confusing. I wonder if any one can help on this?
@{ //Check the currentpage has a value in the property 'photos' if (Model.HasValue("sliderImages")) { var MediaFolder = Library.MediaById(Model.sliderImages); <ul> @foreach (var photo in MediaFolder.Children) { <li> <img src="@photo.umbracoFile" alt="@photo.Name" /> </li> } </ul> } }
Hello,
I'm sorry but Razor in Umbraco doesn't work if you have UseLegacyXmlSchema set to true in the umbracoSettings.config file. For now you can only use xslt or set UseLegacyXmlSchema to false and try to convert your XSLT files with this package: http://our.umbraco.org/projects/developer-tools/xsltupdater-for-umbraco
Jeroen
is working on a reply...