Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Feb 15, 2012 @ 11:25
    Rasmus Fjord
    0

    Simple parameter parsing from template to macro not working

    Hey

    I have created a simple macro with 4 parameters to be used in my templates.

    param alias' (all are of property text) are :

    path

    width

    height

    alt

    im my template it looks like this :

    <umbraco:Macro path="[#highlightImage]" width="11" height="11" alt="11" Alias="ImagegenInserter" runat="server"></umbraco:Macro>

    and in my macro it looks like this

    @{

    var item = Model.MediaById(@Parameter.path);
    <img src="/[email protected]&[email protected]&[email protected]&Constrain=false" alt="@Parameter.alt" />
    }

    When loading the page i get the path and alt text out, but not the height and width(11 is just a test value ofc).

    So the html looks like this :

    <img src="/ImageGen.ashx?image=/media/59/P5010907.JPG&amp;width=&amp;height=&amp;Constrain=false" alt="11">

    Any ideas ?

     


     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 15, 2012 @ 14:50
    Tom Fulton
    0

    Hi Rasmus,

    Not sure about Razor, but in XSLT there is an issue with using some parameter names such as 'width', 'height', 'cssclass', etc.  The issue was they were conflicting with the standard .NET attributes.  So try changing the parameters you are having problems with, ie to imgWidth, imgHeight, etc.

    HTH,
    Tom

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Feb 15, 2012 @ 14:54
    Rasmus Fjord
    0

    Ey Tom

    Thx for the info, thought I deleted this one, and moved to razor.

    Yeah i found out it was reserved words. but thx :) you get a h5 :)

Please Sign in or register to post replies

Write your reply to:

Draft