I have added the parameter to my macro and added in the line as you suggest however I'm still not sure how to write the code for these lines so they inlcude the new parameter aswell:
string[] school = item.school.ToString().Split(',');
if (school.Contains(schoolToFind))
This is my updated code:
@using umbraco.MacroEngines @inherits DynamicNodeContext @{ string schoolToFind = Parameter.ProgrammeSchool; string levelToFind = Parameter.ProgrammeLevel; var root =Model.AncestorOrSelf(1); var programmeNames = root.DescendantsOrSelf("Programme").OrderBy("programmeName").ToList();
<div> @foreach(var item in programmeNames) { string[] school = item.school.ToString().Split(',');
if (school.Contains(schoolToFind)) { <li> <a href="@item.Url">@item.programmeName - @item.qualificationType</a> </li> }
Razor - multiple parameters for macro
Following on from my previous post:
http://our.umbraco.org/forum/developers/razor/46054-Razor-how-to-list-descendants-from-multiple-lists
I now need to add an extra parameter but don't know how to format the code.
I currently have a parameter for ProgrammeSchool which is working fine but I also need one for ProgrammeLevel.
How would I amend the code below:
Thanks Mike,
I have added the parameter to my macro and added in the line as you suggest however I'm still not sure how to write the code for these lines so they inlcude the new parameter aswell:
This is my updated code:
Is the "level" within the document type? OR are you talking about a "level" on the content tree?
Yes 'level' is the alias for a property within the document type (sorry for confusion)
in your foreach loop:
if (school.Contains(schoolToFind))
chage to:
if ((item.level == levelToFind) && (school.Contains(schoolToFind)))
Thanks Mike - perfect!
Thanks Mike - perfect!
is working on a reply...