Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Write rendered EHTML to file

Guest
Posted: Mon Jul 05, 2010 9:59 am Reply with quote
Guest
Hi,

Is there a way to write rendered EHTML to a file instead of returning it?

What I'm trying to do is to make a appmod for generating static HTML
pages based on user input that will be placed in a directory that is
served as a regular static site.

Thanks,

--
Branko Vukelić

bg.branko@gmail.com
studio@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Post received from mailinglist
Guest
Posted: Mon Jul 05, 2010 10:20 am Reply with quote
Guest
On 07/05/2010 11:58 AM, Branko Vukelic wrote:
> Hi,
>
> Is there a way to write rendered EHTML to a file instead of returning it?
>
> What I'm trying to do is to make a appmod for generating static HTML
> pages based on user input that will be placed in a directory that is
> served as a regular static site.
>

Almost,

When the yaws server receives your {ehtml, E} data, it calls
yaws_api:ehtml_expand(E) - you can do the same from your code
before returning - if you then don't want the expand to occur
twice, you can do:

{ok,Html} = yaws_api:expand(E),
file:write(FileFd, Html),
{html, Html}


in your code.




------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Mon Jul 05, 2010 10:34 am Reply with quote
Guest
On Mon, Jul 5, 2010 at 12:19 PM, Claes Wikstrom <klacke@tail-f.com> wrote:
> Almost,
>
> When the yaws server receives your {ehtml, E} data, it calls
> yaws_api:ehtml_expand(E) - you can do the same from your code
> before returning - if you then don't want the expand to occur
> twice, you can do:
>
> {ok,Html} = yaws_api:expand(E),
> file:write(FileFd, Html),
> {html, Html}

Thanks Claes, Rapsey. This was very helpful!


--
Branko Vukelić

bg.branko@gmail.com
studio@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum