Florian Weber wrote:
The reason I said it seems cgikit better separates presentation and logc, is that in nextangle.com, I saw this code:
<% for comment in @post.comments %>
<li> <%= comment.value%> </li>
<% end %>
This may be a question of personal taste, but I really prefer the cgikit solution where there's absolutely no reference in the template to the data we're working on. Now, this opinion is only based on reading the pdf available on rails at the url mentioned. Can someone correct me or
give another opinion on the subject?
you have a reference to the data you are working on. "myrepetition". the only difference
is thate you have a bridge with the binding file. in the template you only refer to the binding
file and the binding file refers to the 'real' data.
i have to admit i dont really see the advantage of it. why the overhead of the binding
file? for sure there is the good old 'designers/html-people can edit templates' without having to
worry about the programming under the hood. but isnt it so much simpler to learn some
basic ruby constructs instead of yet another template language, where sooner
or later you run into problems/limitations.
I have to admit that in using cgikit I didn't experience the binding file as overhead. I find it really practical that, once my template is ok, I don't ever have to go back to it if I want to change something in my code. What do you mean by running into problems sooner or later?
One advantage I can see with the binding is that you can reuse your element in different places in the same pages, and if you change the binding definition, the changes are applied to all occurences in the page. For example a link.
#html
<!-- html header -->
<cgikit name="Link">
<!-- HTML -->
<!-- html footer -->
<cgikit name="Link">
#binding
Link : CKHyperlink
{
href = "http://www.destpage.net";
string = "Ruby Homepage";
query = get_vars;
}
#ruby code
@get_vars = [ { "var1" => "val1"} , {"var2" => "val2"} ]
This results in :
<a href="http://www.destpage.net?var1=val1&var2=val2">Ruby Homepage</a>
in rails, I guess you can do it like
<a href="<%=myurlbuiltwithgetvars%>"><%=linktitle%></a>
But now, what it you forgot to set an attribute for it? Liek the css class to use?
With cgikit, I just add this in the binding:
class="mycssclass";
and it's applied everywhare.
This adds the attribute to all instances. In rails I guess you have to edit all instances of the link. This is one example of why I personally prefer the cgikit way.
In rails, from my understandings, you would have to edit all the link instances, which would be less DRY oriented 
(Correct me if there's a better way to do it in rails,I'm interested to know)
This could be applied to a image you put before each entry in a menu, or to a image you use as the header of a <li>.
with cgikit for example you must know whats going on below the template, how
would you know otherwise which properties you can use for the repetition item, how
its named, etc?
I don't understand what you mean here. You don't specify the repetition item in the template, so no need to know it to design the template. You need it of course for the binding.
for simple views something like xml might work okay. but for more complex stuff
it becomes very tricky, sometimes even impossible. you need something like
a 'programming language'. Use Of Xml
I must admit I haven't build a very complex website with cgikit (yet?), but from my experience in building a bigger site, I didn't see anything blocking in cgikit. To the contrary, I found it very clear and structured. You don't build your website in xml, you have a template that is HTML with <cgikit> tags that are replaced by html.
for sure you can extract everything even remotely complex/programming language
like into components. but thats such a overhead. for sure at first you might think 'well,
i might be able to reuse component later on'. but how can you know? it certainly
doesnt apply for every situation. so yagni really applies here..
Well, I know of some components I could reuse and from my first attempt with cgikit, it worked very well. From there comes my enthousiasm for it 
i hope i dont come across to mean with cgikit. i think its a good think. i just made
some really frustrating experiences with xml templating systems, so im kinda bitter
about it =)
Having another opinion is not a problem for anybody I think (it's even very interesting), as long as the discussion is contructive (which it is now imho 
Raph
···