Loop out uComp multinode picker links with dynamic alias
Want to do something like this:
@using umbraco.MacroEngines;
@{
var columnToList = @Parameter.columnToList;
// columnToList is the alias of my multiple content node picker
// footerLinksColumn1 in this case
}
<ul>
@foreach (var x in @Model.AncestorOrSelf().@columnToList) {
<li>Loop out the link here</li>
}
</ul>
And the XML output from umbraco.config looks like this:
Johan, could you tell what version you use and what error it says when parsing the script? I've just tried it on my local test installation it and it looks ok. Perhaps your installation misses some dll files or configuration.
It is "footerLinksColumn1" in this case. It is just a variable with the name of the alias of the multiNodePicker I'm using. So that i can use the script on many places.
Edit: Oh, and the property type is propertyTypePicker wich i guess is just a string 'cause it outputs "footerLinksColumn1". And if i muanually type "footerLinksColumn1" instead of using the variable in the Select i get the same result as with the variable.
I don't think those are the droids I'm looking for. I think the problem with that solutions is that "yourPicker" is "propertyName" in this case and the dynamic part becomes a problem again :/.
Well, if you want to get a parameter value by the name of parameter represented by a string you can make use of the fact that the actual type of the Parameter property (despite that formally it returns a dynamic value) is 'IParameterDictionary' (you can make sure of it e.g. by the sources) so the following should work I suppose:
var parameterValue = ((IParameterDictionary)Parameter)[parameterName];
Loop out uComp multinode picker links with dynamic alias
Want to do something like this:
And the XML output from umbraco.config looks like this:
Hi,
This project has examples of razor & uComponents MNTP http://our.umbraco.org/projects/developer-tools/cultiv-razor-examples
Though I'm not sure if you're saying you don't know how to loop through the xml or to assign the columnToList?
Rich
Hi. I suspect you want this:
@Rich Green
Thanks for the tip. Awesome package. My issue is however that i want to do this:
But want "footerLinksColumn1" to be a dynamic variable/parameter.
@Rodion Novoselov
Thanks, that is what i want but i still can't get it to work. It wont even parse the script :(
Johan, could you tell what version you use and what error it says when parsing the script? I've just tried it on my local test installation it and it looks ok. Perhaps your installation misses some dll files or configuration.
If i use your exact code i get the following output:
I'm using umbraco 4.7.1. Should i maybe add .MultiNodePicker.nodeId to the end of Model.AncestorsOrSelf().Select(columnToList) ?
Ok. And what is the 'columnToList' parameter in your macro settings? (I mean what type does it have etc?)
It is "footerLinksColumn1" in this case. It is just a variable with the name of the alias of the multiNodePicker I'm using. So that i can use the script on many places.
Edit: Oh, and the property type is propertyTypePicker wich i guess is just a string 'cause it outputs "footerLinksColumn1". And if i muanually type "footerLinksColumn1" instead of using the variable in the Select i get the same result as with the variable.
How about this:
I don't think those are the droids I'm looking for. I think the problem with that solutions is that "yourPicker" is "propertyName" in this case and the dynamic part becomes a problem again :/.
Well, if you want to get a parameter value by the name of parameter represented by a string you can make use of the fact that the actual type of the Parameter property (despite that formally it returns a dynamic value) is 'IParameterDictionary' (you can make sure of it e.g. by the sources) so the following should work I suppose:
is working on a reply...