Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

v6 API Documentation for MNTP

$
0
0
Hello, I'm currently building some Razor Views and have found there's many ways to skin this cat. My preference is to use uQuery as it's consistent, but as a matter of principle, I'm building a new project using the new API's. Whilst looking at the documentation for the MNTP I've become a little confused, as (for me) it seems not to work. [Umbraco Documentation - get Values from uComponents][1] It seems that in the given examples, the API no longer exists. So I have updated the code to the following... @* look at the currentPage, does it contain any values for 'contentRelations'? *@ @if (@CurrentPage.HasValue("contentRelations") && (@CurrentPage.contentRelations.ToString()) != "") { foreach (var x in CurrentPage.contentRelations) { var n = @Umbraco.Content(@x.InnerText); // do something } } 1. Is this the right way to go about this? 2. Could the check be better? (I know it's a MNTP, so can I use that to my advantage, rather than !="") 3. If this is right, should I update the wiki? 4. Should I write code add these items to the Model, rather than littering the view. Thanks! Laurence [1]: http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/get-values-from-ucomponents-multi-node-tree-picker-multiple-textstring

Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>