Copied to clipboard

Flag this post as spam?

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


  • Robert Brown 18 posts 38 karma points
    Apr 23, 2014 @ 21:17
    Robert Brown
    0

    how do i use Contour Library methods in Umbraco v7.1.1

    I understand that Umbraco version 7 did away with extended xslt. So how can I use the former macros such as GetApprovedRecordsFromPage using the UI. The macros don't exist in version 7 so is there a new way to get records instead of using xslt?

    Thanks

    Robert

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 23, 2014 @ 22:04
    Dennis Aaen
    0

    Hi Robert,

    I found some documentation for working with data from Contour in Razor,

    http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Working-with-Contour-data-in-Razor/

    I hope this help you in some way.

    /Dennis

  • Robert Brown 18 posts 38 karma points
    Apr 24, 2014 @ 21:57
    Robert Brown
    0

    Thank you, That got me close.

    Robert

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 25, 2014 @ 10:28
    Dennis Aaen
    0

    Hi Robert,

    Did you find out how to use the Contour Library methods in Razor. If not this could be a an example of how to get GetRecordsFromForm:

    @Umbraco.Forms.Mvc.DynamicObjects.Library.GetRecordsFromForm("e14b84d2-3aab-413a-95da-7bc29521572b");

    http://our.umbraco.org/forum/umbraco-pro/contour/50231-GetRecordsFromForm-in-Razor?p=0#comment179809

    /Dennis

  • Robert Brown 18 posts 38 karma points
    Apr 25, 2014 @ 15:49
    Robert Brown
    0

    Yes, I had to modify the document example and have a basic razor script working. Here it is:

    @inherits umbraco.MacroEngines.DynamicNodeContext

    @using Umbraco.Forms.Mvc.DynamicObjects

    <ul id="comments">

     @foreach (dynamic record in 

               Umbraco.Forms.Mvc.DynamicObjects.Library.GetApprovedRecordsFromPage(@Model.Id).OrderBy("Created"))

     {

         <li>

              @record.Created.ToString("dd MMMM yyy")

              @if(string.IsNullOrEmpty(record.Website)){

                 <strong>@record.Name</strong>

              }

              else{

                 <strong>

                   <a href="@record.Website" target="_blank">@record.Name</a>

                 </strong>

              }

             <span>said</span>

            <p>@record.Comment</p>

         </li>

      }

    </ul>

     

    Thanks

     

    Robert

Please Sign in or register to post replies

Write your reply to:

Draft