You are not logged in.
Pages: 1
Works, thanks!
Hello,
I have the following template:
{{Title}}
{{#Favorite}}
<strong><a href="{{Link}}">{{Name}}<a></strong><br />
{{/Favorite}}
and here is my (simplified) data classes:
type
TFavorite = class
public
property Name: String read fName write fName;
property Link: String read fLink write fName;
end;
TFavorites = class(TList<TFavorite>);
THTMLFile = class
public
property Title: String read fTitle write fTitle;
property Favorites: TFavorites read fFavorites;
end;
Here is my (simplified) function in set the data to the TSynMustache instance:
var
Mustache: TSynMustache;
HTMLFile: THTMLFile;
Doc: Variant;
begin
Mustache := TSynMustache.Parse(//template//);
TDocVariant.New(Doc);
TDocVariantData(Doc).AddValue('Title', HTMLFile.Title);
TDocVariantData(Doc).AddValue('Favorites', HTMLFile.Favorites); // <----- !!!
Result := Mustache.Render(Doc);
end;
I do not know how to set a list of data (HTMLFile.Favorites).
Many thanks for the help!!!
Pages: 1