On Dec 17, 2007 10:01 PM, maddiin <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> thanks for the answers, it was quite helpful. Most important: I found
> out how to make use of the component system and was able to put all
> logic in controllers.
>
> Following the checklist:
>
> 1. I copied David´s example and it works for now. I will ask later for
> more help about it.
>
> 2.+4. Now that I know how to use controllers and views correctly it
> seems odd to me to have directories for each component. :=) Most
> confusing for me was that I thought I have to use an app_view.erl, saw
> that in the musician example and the tutorial from
> progexpr.blogspot.com. So if you talk about views you mean .et files,
> I wasn´t sure about and that was confusing me. The example in the
> foreach-topic was really helpful, more examples would be great.

The app views used to be a part of ErlyWeb, but they were replaced by
components +  'phased' rendering. Unfortunately, those old tutorials
are still on my blog so I see where the confusion would come from :)

>
> 3. Still not understanding this, I just know how to use a sidebar that
> is the same on every page. I would appreciate if someone could give me
> an example based on the blog instead of a general explanation.

Do you want a different sidebar for every page, or the same sidebar
(but with dynamic contents)? If you want a different sidebar, you can
include it in your components directly, so each component could chose
which sidebar to include. If you want the same sidebar, include it in
the html_container (or the main_layout_container as in my previous
email).

I think you probably want the same sidebar, in which case I would
create a sidebar component and include it in main_layout_container
next to the requested component, e.g.:

sidebar_controller:

index(A) ->
  {data, ...}.

sidebar_view:

<%@ index(Data) %>
<div id="sidebar">
<h1>sidebar</h1>
<% Data %>
</div>

main_layout_container_controller:

index(A, Ewc) ->
  [{ewc, sidebar, [A]},
   Ewc].

main_layout_container_view.et:

<%@ index([Sidebar, Data]) %>
<table>
  <tr>
    <td><% Sidebar %></td>
   <td><% Data %></td>
  </tr>
</table>

app_controller:

hook(A) ->
  {phased,
    {ewc, A},
    fun(Ewc, Data, _PhasedVars) ->
      {ewc, html_container, [A, {ewc_main_layout_container, [A, {data, Data}]}]}
    end}
>
> 5. I renamed the tables to use singular names and ran into a name
> clash (using author now instead of user). So if you are new to Erlang/
> ErlyWeb, too, then have a look at http://erlang.org/doc/man_index.html
> and make sure, you don´t name your sql-tables/controllers like one of
> the modules listed in the Erlang manual page.

That one got me too. Now I use 'usr' :)

Yariv

>
> maddiin
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to