[erlang-questions] Basic questions, also related to yaws and mnesia

Filippo Pacini <>
Tue Oct 16 15:23:35 CEST 2007

I'm a little partisan here :-), but you might be interested in sgte

It' s a simple template language. In your example you could write
something like this:

gen_html(Entities) ->
Data = [{entities, [sgte:rec_to_kv(Rec, record_info(fields,
entity_links)) || Rec <- Entities]}],
{ok, C} = sgte:compile("$map:{<a href=\"$main_url$\">$url_title$</a>}
sgte:render(C, Data)}.

The template instead of a string can also be an html file, so you can
write html templates containing sgte instructions and you pass the data
to be rendered at runtime.


Berlin Brown wrote:
> I should probably move away from yaws for a sec and go over the
> basics, but I am really close to what I want to do.
> I have a record and a list of records, but I don't know the best ways
> to extract the data and show the data out of the record.
> For example, with this code; how would I iterate(map?) those links and
> display them.
> out(Args) ->
> 	{ok, EntityLinks} = botlist_find_links:find_links(),
> 	{ html,
> 	 	yaws_api:f("~p", [EntityLinks])
> 	}.
> This is the record.
> -record(entity_links, {main_url, url_title, keywords, rating,
> full_name, created_on}).

More information about the erlang-questions mailing list