Im trying to convert a Scripting File into a Partial View Macro File, and I cant really figure out why its not loading. Can anyone see what im doing wrong? I've added the code for both the scripting file and the partial view macro.
Scripting File:
@inherits umbraco.MacroEngines.DynamicNodeContext @{ if (@Model.HasProperty("homepageArticleTags")) { var tagsList = Model.homepageArticleTags; if (tagsList != null) { <h2><span>Kategorier:</span></h2> <ul> @foreach (var tag in tagsList) { <li class="magazineTags"> <a href="/SearchOverview.aspx?tag=@tag">@tag</a> </li> } </ul> } } }
Partial View Macro File:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if (@CurrentPage.HasProperty("homepageArticleTags")) { var tagsList = CurrentPage.homepageArticleTags; } } @if (tagsList != null) { <h2><span>Kategorier:</span></h2> <ul> @foreach (var tag in tagsList) { <li class="magazineTags"> <a href="/SearchOverview.aspx?tag=@tag">@tag</a> </li> } </ul> } }
Error loading Partial View script?
Im trying to convert a Scripting File into a Partial View Macro File, and I cant really figure out why its not loading. Can anyone see what im doing wrong? I've added the code for both the scripting file and the partial view macro.
Scripting File:
Partial View Macro File:
Hi Nicolai,
What if you do something like this would it work?
Hope this helps,
/Dennis
It still doesnt load. Im getting the fallowing error at where im trying to display this macro:
"Error loading Partial View script (file: ~/Views/MacroPartials/AllNodeArticleTags.cshtml)"
Hi Nicolai,
I just have a second look at your code, and I think that this updated version would work for you.
Hope this helps,
/Dennis
Nevermind, I got it to work.
I forgot that tagsList is from the datatype tags and they are Comma Separated Strings. I just added tagsList.Split(',')
Thanks alot for the help, can you explain why it didnt work in the first place?
Hi Nicolai,
What type of field did you use in the backoffice to add and store the tags, a text string the property editor that is named tags?
Looking forward to hear from you :-)
/Dennis
is working on a reply...