Btw, also check out Yaws's ehtml. It's quite similar to what you described.
On Feb 9, 2008 2:31 AM, Yariv Sadan <[EMAIL PROTECTED]> wrote:
> I have been thinking too about how in some cases (as in the Arc
> challenge), it looks like creating the html in the controller using
> function calls or objects (like ehtml) and skipping the view could
> make the code shorter. My current impression -- and I could be wrong
> -- is that Arc style programming works better when most of the content
> is dynamic and that ErlyWeb style works better when you have large
> amounts of static html in which small amounts of dynamic data is
> embedded.
>
> Btw, you can bypass views today by returning {response, [...]}, so
> nothing is preventing you from doing Arc style programming in ErlyWeb.
> You just have to write some library functions for generating html
> entities and maybe add support for continuations in ErlyWeb (this
> isn't too hard).
>
> Yariv
>
>
> On Feb 8, 2008 9:23 PM, jm <[EMAIL PROTECTED]> wrote:
> >
> > I've been looking at some of the other web frame works out there and my
> > own code looking for ideas to improve matters in erlyweb. One thing that
> > I've noticed is that I'm repeating things in the view that I've written
> > in the controller but only in a slightly different way. I've noticed
> > that many of the web developement frame works that don't use MVC use a
> > model and a canvas analogy to save on this repetition.
> >
> > An example of what I'm thinking: create a page with a link and a form
> > with one text field and a submit button.
> >
> > -module(simple_controller).
> >
> > new(_A) ->
> > %% include a call back function with the link
> > Link = html_link:new("hello", fun() ->
> > "hello there!"
> > end),
> > TextField = html_input:text_field(),
> > Submit = html_input:submit(),
> >
> > %% include a call back function with the form
> > Form = html_form:new(fun(Fields) ->
> > simple:process_new(Fields)
> > end),
> > Form1 = html_form:add(Form, TextField),
> > Form2 = html_form:add(Form1, Submit),
> >
> > Base = html_div:new(),
> > Base1 = html_div:add(Base, Link),
> > Base2 = html_div:add(Base, Form),
> > Base2.
> >
> >
> > render(Layout) ->
> > html:render(Layout).
> >
> >
> > Rough internal representation,
> >
> > {div, ..., [
> > {link, LinkId, "hello", CallBackFun},
> > {form, FormId, CallBack, [
> > {input, text_field, FieldId, Value},
> > {input, submit, SubmitId, undefined}
> > ]
> > }
> > ]
> > }
> >
> >
> > Output
> > <div>
> > <a href="http://server/simple/_12345_>hello</a>
> > <form action="http://server/simple/_12346_">
> > <input type="text"/>
> > <input type="submit"/>
> > </form>
> > </div>
> >
> > Now there's bound to be errors in the above, but I the basic idea should
> > be clear. The html is generated much like a GUI, say, wxwidgets or Qt.
> > call back functions are added to direct process flow, Ids are
> > automatically generated to direct processing to the correct callback.
> > Rest style URLs are still processed as is, ie http://server/simple/new
> > will call the above new/1 function.
> >
> > There's still abit unclear about this. For example, what's the best way
> > to alter/add attributes to the html without it becoming to verbose.
> >
> > This started as scribles in a note book as I waited for a meeting to
> > begin a couple of days ago and is being posted "as is" after I saw
> > yariv's posts about arc this morning.
> >
> > Jeff.
> >
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---