Hiho,

http://www.fossil-scm.org/fossil/timeline?r=th1-query-api

A new th1 feature: PHP-like output capturing/buffering. e.g....

<th1>
puts "this is unbuffered"
ob start
puts "this is buffered"
</th1>
this part is also collected in the buffer.
<th1>
set buf [ob get end]
# Or:
# set buf [ob get]
# ob end
puts "This is now unbuffered, but we buffered: $buf\n"
</th1>

it's not _quite_ PHP-compatible (slightly different API), but it seems to
work and supports nesting arbitrarily deep. When a nested level is opened
all output is buffered until the level is closed/ended, at which point the
client may collect or discard the buffer.

Why? This is remarkably useful for generating long output which we do not
yet want to output, e.g. HTML SELECT elements with arbitrarily many
options. e.g.:

ob start
generate_lots_of_stuff
set foo [ob get end]

This is somewhat more efficient, and certainly easier than, doing a bunch
of th1 string manipulating to get the same effect. It also makes it easier
to glue disparate pieces of output together in useful ways.

Happy Hacking!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to