This has been driving me crazy for about 3 hours now. We upgraded from Umbraco 4 to Umbraco 7 and now our site menus are broken. We used to use a script that traversed the nodes and created a CSS menu system.
So I have started reading up on the new stuff and I just can't even get a @helper or @functions block to work. The script is now using a PartialView Macro that uses a parameter called MenuNode that is the Node I want to traverse down.
Here's the code that works:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var menuNode1 = string.IsNullOrEmpty((string)Model.MacroParameters["MenuNode"])? 0 : Convert.ToInt32(Model.MacroParameters["MenuNode"]);
}
<h1>@menuNode1</h1>
As soon as I try to add a @helper or @functions like in the Navigation PartialView example provided in Umbraco it stops working. Here is what breaks it.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var menuNode1 = string.IsNullOrEmpty((string)Model.MacroParameters["MenuNode"])? 0 : Convert.ToInt32(Model.MacroParameters["MenuNode"]);
}
@TestHelper(menuNode1)
@helper TestHelper(var testvalue)
{
<h1>@testvalue</h1>
}
Can anyone point me at what I'm doing wrong?