i have a webpage iam about to move from V6 to V7 and i have a problem getting my macro to work, it is a cshtml and i must say i dont know howe to get it over in XSLT.
i hope som can help me.
my macro is.
@inherits umbraco.MacroEngines.DynamicNodeContext
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (Model.Children.Where("Visible").Any())
{
<ul>
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
@foreach (var childPage in Model.Children.Where("Visible"))
{
<li class="CleanURl">
<div id="ServiceMacroWrapper">
<div id="ServiceMacroImageDiv">
<a href="@childPage.Url"><img class="ServiceMacroImage" src="@childPage.image" /></a>
</div>
<div id="ServiceMacroTextDiv">
<div class="ServiceMacroText">
@(Library.Truncate(Library.StripHtml(childPage.bodyText), 200, true))
</div>
<div><a class="readmore" href="@childPage.Url">Læs mere →</a></div>
</div>
</div>
</li>
}
</ul>
}
Make macro work i V7
Hey,
i have a webpage iam about to move from V6 to V7 and i have a problem getting my macro to work, it is a cshtml and i must say i dont know howe to get it over in XSLT.
i hope som can help me.
my macro is.
Hi Michael,
Can't see what is wrong on first sight.
Maybe you can comment everything and add things bit by bit untill it breaks again. Then we can find the offending line in the code.
Dave
Hey Dave,
i try this combo, my problem is the text part i can't get to work it show´s up link on img.
Hi Michael,
The "@Library.Truncate" is razor syntax. XSLT will output this text as is.
I think there are some equivalents for those methods in xslt but it has been ages since I last wrote a xslt macro in Umbraco.
The docs for writing xslt macro's can be found here : https://our.umbraco.org/documentation/reference/templating/macros/xslt/
Unfortunately the part about the Umbraco Library is not documented.
The functions available can be found in this source file : https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web/umbraco.presentation/library.cs
I gave it a try but can not promise if it will work :
Personally I would have tried to fix the razor macro. But XSLT is going to be deprecated in future versions of Umbraco.
Dave
Thaks for the true Dave,
my reason to try make it chance was that in v 7 the Scripting files section is no longer and i god confused i normaly make them in that..
bu i just uploadet the old files and made them work wit a macro..
Best regards Michael
is working on a reply...