Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion <title>s and other non-component data
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David King  
View profile  
 More options Nov 16 2007, 1:19 pm
From: David King <dk...@ketralnis.com>
Date: Fri, 16 Nov 2007 10:19:08 -0800
Local: Fri, Nov 16 2007 1:19 pm
Subject: <title>s and other non-component data
erlyweb uses a component system for rendering pages. It makes most of  
my controller functions return lists like this:

   [{data,post:title(Post)},
    {ewc,post,contents,[A,Post]},
    {ewc,comment,comments,[A,post:comments(Post)]}]

The view function then looks like:

   <%@ show([Title,Contents,Comments]) %>
     <h1><% Title %></h1>
     <div class="post_contents"><% Contents %></div>
     <ul class="comments><% Comments %></ul>

I really like this, because it allows me to separate the view-logic  
for things like contents and comments out from each other, which  
makes changing the behaviour of these quite simple, localised, and re-
useable. (In fact, as I re-write portions of erlyweb for my purposes,  
the component system is something that I haven't touched at all  
because it works quite well.) However, it has an inherent limitation:  
none of those functions can return data to be rendered outside of  
their components. In my case, I'd like to be able to set <title>  
tags, which means that the top-level controller function (by top-
level, I mean the one referenced in the URL; like in /post/show/12,  
the top-level controller function would be show/2) needs to somehow  
return information to be rendered outside its little sandbox.

I see that Vimagi doesn't set <title> tags (neither <http://
vimagi.com/p/0PXmMRe6hGV> nor <http://vimagi.com/users/feeling3_4>  
set one, at least, and those are where I'd expect to see them), but  
BeerRiot does (<http://beerriot.com/beer/view/1751>; BTW I do love  
the idea of having a controller called "beer_controller").

It isn't limited to <title>s (for instance, I may want to alert the  
browser that an RSS equivalent of this page exists, or what the  
caching TTL is for this page in the HTTP headers). Conceptually, how  
would one go about returning this extra information, while still  
using the component system (I now have a lot of code that uses it  
that I'd like to not re-write :) )?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.