Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  Returning HTML from the controller (aka bypassing the view)

Guest
Posted: Tue Mar 04, 2008 10:09 am Reply with quote
Guest
Hi,

I have a scneario where I would like to have a controller and no view
and just return html directly from the controller.

Is there a way to do this?
If so can someone please provide a short example of how to do this? I
was reading list archives and seen Yariv mention that it was possible
to do this with the "response" tuple but I couldn't figure out what
the arguments would be. Will erlyweb be happy if there is no view
component defined or will I have to define a dummy one to keep things
happy, I expect not just checking.

Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 4:33 am Reply with quote
Guest
This is something I missed at first as well. Try {response, Elems} where
Elems is a yaws tuple, eg

{response, {ehtml, {form, [{action, Path}],
{input, [{type, text}, FieldData,
[]}}


see also http://yaws.hyber.org/dynamic.yaws

hope this helps.

Jeff.

Colm wrote:
> Hi,
>
> I have a scneario where I would like to have a controller and no view
> and just return html directly from the controller.
>
> Is there a way to do this?
> If so can someone please provide a short example of how to do this? I
> was reading list archives and seen Yariv mention that it was possible
> to do this with the "response" tuple but I couldn't figure out what
> the arguments would be. Will erlyweb be happy if there is no view
> component defined or will I have to define a dummy one to keep things
> happy, I expect not just checking.
>
> Thanks.
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 5:44 am Reply with quote
Guest
Also,

If you want to return the response HTML verbatim, you can return

{response, [{html, <<"<html><body>...</html>">>}]}

If you want to return something that will be further processed by the
'phased' mechanism, you can return

{response, [{rendered, <<"<div>...</div>">>}]}

Yariv

On Tue, Mar 4, 2008 at 2:14 PM, jm <jeffm@ghostgun.com> wrote:
>
>
> This is something I missed at first as well. Try {response, Elems} where
> Elems is a yaws tuple, eg
>
> {response, {ehtml, {form, [{action, Path}],
> {input, [{type, text}, FieldData,
> []}}
>
>
> see also http://yaws.hyber.org/dynamic.yaws
>
> hope this helps.
>
> Jeff.
>
>
>
> Colm wrote:
> > Hi,
> >
> > I have a scneario where I would like to have a controller and no view
> > and just return html directly from the controller.
> >
> > Is there a way to do this?
> > If so can someone please provide a short example of how to do this? I
> > was reading list archives and seen Yariv mention that it was possible
> > to do this with the "response" tuple but I couldn't figure out what
> > the arguments would be. Will erlyweb be happy if there is no view
> > component defined or will I have to define a dummy one to keep things
> > happy, I expect not just checking.
> >
> > Thanks.
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived 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 cannot attach files in this forum
You cannot download files in this forum