This is what I am doing with blogrolls, which are related to
categories:

sidebar_controller.erl:

category(A, Category_id) ->
  [{ewc, category, [A]}, {ewc, blogroll, [A, Category_id]}].


blogroll_controller.erl:

index(A, Category_id) ->
   Blogs = blogroll:find({category_id,'=',Category_id},{order_by,
[{position, asc}]}),
   [{ewc, blogroll, blog, [A, Blog]} || Blog <- Blogs].

blog(A, Blog) ->
    [{data, blogroll:url(Blog)}, {data, blogroll:title(Blog)}].

And now the blogroll_view.et... I could only figure out this way:

<%@ index(Blog) %>
<% [case Blog of
        [] -> "";
        Blog -> ["<h4>Blogroll</h4>\n<ul>\n", Blog, "</ul>"] end] %>

<%@ blog([Url, Title]) %>
<li><a href="<% Url %>"><% Title %></a></li>

The point is, that if there are no blogs in the roll for a certain
category nothing should be shown at all (heading and empty unordered
list). If you can tell me a way doing this in the controller I have
nothing against keeping ErtTL the way it is, just do something about
the whitespace and I would be fine with it.
--~--~---------~--~----~------------~-------~--~----~
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