Arc Forum | I've been able to create one using Ruby and my Web Framework like this: tt = [ ...

3 points by namaste 6498 days ago | link | parent

I've been able to create one using Ruby and my Web Framework like this:

 tt = [
 '<form method="POST"><input name="t" /><input type="submit" name="OK"></form>',
 '<a href="said?show=1">click here.</a>', 
 "you said: #{@w.session['t']}"
 ]
 ti = 0 
 if @w.f(:OK)
 @w.session['t'] = @w.f(:t) 
 ti = 1
 elsif @w.q(:show)
 @w.session['do_show'] = true
 @w.redirect 'said'
 elsif @w.session['do_show']
 @w.session['do_show'] = nil
 ti = 2
 end
 @w.content = tt[ti]
I'm not sure how other folks will solve it though. It's interesting that my Web Framework has support for both pure Ruby like this, and for a templated approach similar to PHP but using Tenjin: * http://www.kuwata-lab.com/tenjin/

I wanted to keep it all in one URL and without template for this though. I'm not sure I'd normally program it like that, as I enjoy multiple pages and URLs. Anyway, many ways to skin a cat, and Arc did good.

P.S. In the past my framework had a more "programming" approach which was based on ideas I grasped from Wee which was itself based on Seaside. But since it has been dropped, but your challenge reminds me of it.




AltStyle によって変換されたページ (->オリジナル) /