Copied to clipboard

Flag this post as spam?

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


  • Nick Schweitzer 4 posts 24 karma points
    Mar 01, 2013 @ 20:36
    Nick Schweitzer
    0

    Nothing Seems to Work!

    I have installed the following packages related to DAMP:

    • Digibiz Advanced Media Picker - v2.5
    • DAMP Property Editor Value Converter - v1.2
    I am running Umbraco v6.0.0 (Assembly v1.0.4779.24222)
    I created a new Data Type called "Article Banner" with teh following properties:
    • Render Control - Digibiz Advanced Media Picker
    • Store: Full media XML
    • Start Node Options - Media Picker (chose a node in my media tree), Ignore Start Node for Admin = True
    • Restrictions - Selectable = Image, Createable = Folder & Image, Default Media Type = Image
    • Muliple Media = No
    • Everything else default
    I then added "Article Banner" as a property on a document type, and called the property "headerImage". I can create the Document Type, and successfully set the property in the back end. However, in my Template code, nothing I seem to do according to the Razor documentation works to display the image. This is what I thought should work:
    @if (Model.HeaderImage.Any()) {
    <img src="@Model.HeaderImage.First().Url" style="margin: 5px 0px 5px 0px" />
    }
    I get the following exception when I do this:
    Error Loading Razor Script (file: ) 'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'Url'    at CallSite.Target(Closure , CallSite , Object )
      at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
      at ASP._Page_App_Data_TEMP_Razor_inline_b9c58f9cc944c15f3529ea55b23b9039_cshtml.Execute()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

  • Jeroen Breuer 4861 posts 12136 karma points MVP 3x admin c-trib
    Mar 02, 2013 @ 18:29
    Jeroen Breuer
    0

    Hello,

    On the DAMP Property Editor Value Converter page it says the following:  

    "There are 2 versions of this package. The first version is called the DAMP Razor Model and works on Umbraco 4.7.1.1 and higher with the old Razor: http://bit.ly/SV0jc6

    The second version is called the DAMP Property Editor Value Converter and works on Umbraco 4.10 and higher with the new Razor: http://bit.ly/VTMAFC"

    You installed the second version for the new Razor, but when I look at your code your using the old Razor. The new Razor is used on template views when the website has the defaultRenderingEngine set to MVC. The old Razor is used in macro's. 

    Installing the DAMP Razor Model probably solves your problem.

    Jeroen

  • Nick Schweitzer 4 posts 24 karma points
    Mar 02, 2013 @ 18:32
    Nick Schweitzer
    0

    OK - That makes some sense. I would recommend you clarify your package documentation to say instead of "New Razor" and "Old Razor" that you instead specify whether you're using Mvc or not. Otherwise I assumed that New Razor and Old Razor simply had to do with the version of Umbraco that was installed. I'll try this and get back to you. Thanks.

  • Jeroen Breuer 4861 posts 12136 karma points MVP 3x admin c-trib
    Mar 02, 2013 @ 18:42
    Jeroen Breuer
    0

    Thanks for the feedback. I agree with you that there should be more clarity between the different version of Razor in Umbraco, but that should be the responsibility of Umbraco and not me. They created 2 different versions without writing a lot of info about it. Maybe this topic can help: https://groups.google.com/d/msg/umbraco-dev/WC_7OTF_lO0/31b_k4vsJ90J

    Jeroen

  • Zakhar 171 posts 397 karma points
    May 08, 2014 @ 14:10
    Zakhar
    0

    Ok, I've found this post which clarifies some things.

    Basically, I have the same problem as Nick.

    • I have Umbraco 6.1.6

    • I installed Digibiz Advanced Media Picker v2.8

    • Installed DAMP Razor Model v1.2

    here is my xml from umbraco.Config:

     <images>
      <DAMP fullMedia="">
        <mediaItem>
          <Image id="1069" version="aca7833b-9167-4c88-a5a4-7bf77bb13611" parentID="1066" level="2" writerID="0" nodeType="1032" template="0" sortOrder="2" createDate="2014-01-14T17:53:59" updateDate="2014-01-14T17:53:59" nodeName="Financials Workflow" urlName="financialsworkflow" writerName="zakhar" nodeTypeAlias="Image" path="-1,1066,1069">
            <umbracoFile>/media/1005/financials-workflow.png</umbracoFile>
            <umbracoWidth>640</umbracoWidth>
            <umbracoHeight>350</umbracoHeight>
            <umbracoBytes>90040</umbracoBytes>
            <umbracoExtension>png</umbracoExtension>
          </Image>
        </mediaItem>
        <mediaItem>
          <Image id="1068" version="96510599-85fa-4442-9fc0-db63121d6175" parentID="1066" level="2" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2014-01-14T17:53:58" updateDate="2014-01-14T17:53:58" nodeName="DATAFLOW" urlName="dataflow" writerName="zakhar" nodeTypeAlias="Image" path="-1,1066,1068">
            <umbracoFile>/media/1004/DATAFLOW.gif</umbracoFile>
            <umbracoWidth>640</umbracoWidth>
            <umbracoHeight>397</umbracoHeight>
            <umbracoBytes>195066</umbracoBytes>
            <umbracoExtension>gif</umbracoExtension>
          </Image>
        </mediaItem>
    

    Im trying to do this:

    @if (ver.HasValue("Images"))
    {
        <ul>
        @foreach (dynamic d in ver.Images)
        {
            <li>
                <a class="popup" rel="gallery" href="#">
                    <img src="@(d.Url)" alt=""/>
                </a>
            </li>
        }
        </ul>
    }
    

    And getting

    'Umbraco.Core.Dynamics.DynamicXml' does not contain a definition for 'Url'
    

    I'm lost at this point, is it old or new Razor I'm using? I simply need to get my image url, do I need to install anything else? Where can I find an example of "new razor"?

    Any help will be greatly appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft