dorphalsig
dorphalsig

Reputation: 711

DotLiquid not parsing my template

Or better yet... There's something I'm not doing right :s

Anyway, this is simple, I have this class

[LiquidType("RegionName", "AreaName", "PropertyName", "PropertyAddress", "PropertyZipCode", "PropertyId", "YearBuilt", "CommunitySpecial", "PropertyPhone", "PetPolicy", "Ammenities", "Features", "ComissionRate", "Bedrooms", "Price", "Size", "Bathrooms", "Images", "Floorplan")]
public class AdModel:Ad
{
    public String BaseFolder;
    protected String PropertyId { get; set; }
    protected String RegionName { get; set; }
    protected string CommunitySpecial { get; set; }
    protected string PetPolicy { get; set; }
    protected string Ammenities { get; set; }
    protected string Features { get; set; }
    protected string ComissionRate { get; set; }
    protected String[] Images { get; set; }
    protected String Floorplan { get; set; }
    protected Byte[] FloorplanImage { get; set; }
    protected Byte[][] PropertyImages { get; set; }

    [...]

    private String ParseTemplate(String templateFilePath)
    {
        var tpl = Template.Parse(File.ReadAllText(templateFilePath));
        return tpl.Render(Hash.FromAnonymousObject(this));
    }

    [...]

}

and I Have this template:

{{Bedrooms}}Br in {{AreaName}} for only {{Price}}.

When I call ParseTemplate(somePath);, the result I get is: Br in for only.

What am I doing wrong?

NOTE The properties that are not declared in AdModel and are mentioned here, are declared as Public in Ad, so (in theory) there shouldn't be a problem accesing them from within AdModel

Upvotes: 1

Views: 2232

Answers (1)

dorphalsig
dorphalsig

Reputation: 711

I read somewhere (I think it was here is SO), that dotLiquid 'Rubizes' the variable names, so a wild guess turned {{Bedrooms}} into {{bedrooms}}.

Go figure

Upvotes: 2

Related Questions