From: Florian Weber Date: 2004-07-26T02:12:24+09:00 Subject: Re: rubyonrails and cgikit comparison > 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? with running into problems sooner or later i meant that sooner or later it will get really annoying that you only have two choices: use xml to do something very programming language like or to write components for every tiny little special thing.. > 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 > > > > > > > #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 : > Ruby Homepage > > in rails, I guess you can do it like > > <%=linktitle%> > > 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) totally simple with rails. you can just write a little helper method for for links. david already did some nice stuff like this to allow for example: <%= link_to "some link", :action => "foo", :params => { "var1" => "val1", "var2" => "val2"} %> http://localhost/pages/foo?var1=val1&var2=val2 for sure you can also pass additional html options to the link_to helper method.. the thing you described earlier could be easily done with a little helper method also.. same thing, just less indirection.. > >> 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. well, but you need to know the the properties of the items when you wanna display them on the page, no? >> 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'. >> http://www.martinfowler.com/bliki/UseOfXml.html > > 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 tags that are replaced by html. to me the cgikit templates look pretty much like (x)html + xml..