Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • asaaheim 9 posts 39 karma points
    Jan 10, 2013 @ 19:15
    asaaheim
    0

    Razor with uComponents MultiNode Picker to present content from nodes in menu tree

    Heya, brand new to Razor and have setup our Umbraco to work well with the multi-node tree picker, so that it is easy for our client to pick which nodes they wish to present on the frontpage. We've created a menutree separated from our contenttree, and our client use the menutree to generate menu items and the content tree for generating all the content. Thus, they can create content that is easily available through the menu as well as content that is only accessible through insite links on different contentpages.

    The basic idea of what we want for them now, is presented at sumac.uk.com, they do what we wish to do pretty much, only for a portfolio, whereas we'd like it for testimonials. Here is the link to their excellent article on how they did it: http://www.sumac.uk.com/opening-up/index.php/2011/10/21/umbraco-tech-tip-the-ucomponent-multi-node-tree-picker-guide/

    As we are going away from xslt and would need the same functionality with Razor, are there any ideas from you fine folks that might help me get going?

    We have created the sub-menu and the client likes how they can so easily pick which nodes they would want present at the frontpage at any given time, rather than having a property on each node that they would need to toggle on/off.

    I am guessing my question is how I go about to get the Children or Descendants of a named part of the menu tree to retrieve content from those nodes for presentation on the frontpage?

    The menu tree is more or less like this:

    -Frontpage
    ->Content (contentpages)
    ->Menus (menu structure)
    --Main menu (the menu items presented in the main menu on the website)
    --Testimonials (multinode tree picker w/ allowed multiple select)

    So, I need to be able to fetch the items the user has picked under Testimonials, and need to get access to the content of these nodes for presentation in a slider on the frontpage.

    Being a very fresh user here, I apologize if my question is not well formed, please do ask for clarifications if it may help you help me.

    Thanks in advance!

     

  • asaaheim 9 posts 39 karma points
    Jan 11, 2013 @ 09:27
    asaaheim
    0

    Tried to delete this topic multiple times, and edit it - but it gives an error...

    Just wanted to shorten it and basically ask for any tips on doing this https://gist.github.com/1303495 XSLT in Razor?

    Thanks guys!

  • gary 385 posts 916 karma points
    Jan 12, 2013 @ 14:36
    gary
    0

    Hi assaheim

    Will try to point you in the right direction - but as I have no clue about xslt - I cannot fully help.

    But will point out that I am using 4.11.1 in MVC mode as calls may be different if using the weforms (masterpages) mode; Below is code that is running.

    To get a property from a page lower in the tree;

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{

       var blob= CurrentPage.AncestorOrSelf().Descendants("article").Random(10);

    }
    This is a Where statement - the "article" is the docType alias - so this gets you to the page. The Random can be .Take(int) etc
    AncestorOrSelf(2), gives level 2 etc.
            @{
                foreach (var item in blob)
                {
                    dynamic media = item.Image.First;
                        <a href="@item.NiceUrl()">
                            <img class="image" src="@media.Crops.Half" />                            
                                    <h3>@item.GetPropertyValue("Property")</h3>
                                </div><!-- center --> 
    <\a>
    }
    The images are using DAMP - with the DAMP property editor which helps with this call.
    Jeroen has set up a demo site which has a page with the use of MNTP in razor - you can access from the project page - DigiBiz Advanced Media Picker.
    You can also use the Razor Walkthrough or Razor Node Cheat Sheet as much of it is still relevant in terms of traversing etc.
    Hope it helps you move forward - if I can help anymore, please let me know.
    Regards
    Gary
  • asaaheim 9 posts 39 karma points
    Jan 22, 2013 @ 13:22
    asaaheim
    0

    Thanks for your response, sorry I am slow to respond but some changes were made and we did not require this setup for the project any longer - however, we are very likely to make use of this for future projects.

    Thanks a lot!

    -A-

Please Sign in or register to post replies

Write your reply to:

Draft