What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
I am running Apache on Windows XP.
Robert
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
I am running Apache on Windows XP.
Robert
Hello Robert,
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
Amrita and eRuby.
--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's
Robert wrote:
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
You should take look at Rails (Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.).
Hi --
On Mon, 2 Aug 2004, Robert wrote:
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
I've made a lot of use of the Template module from RubLog.
David
--
David A. Black
dblack@wobblini.net
There's a class CGI. And there's a lot of templating systems, eruby, amrita
you name it.
robert
"Robert" <catcher@linuxmail.org> schrieb im Newsbeitrag
news:1-udnVPrVeO90JDcRVn-vg@adelphia.com...
What do you use when programming Ruby/CGI? Do you just use straight Ruby
or
do you use any templating modules?
I am running Apache on Windows XP.
Robert
I've had some good luck using PageTemplate =>
http://pagetemplate.sourceforge.net/ However, lately I've been heavy
into learning Rails => http://www.rubyonrails.org
Hi Robert,
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
Here is a tiny template ``engine'' I use that creates a Struct class
and defines its #to_s method:
class StructTemplate
TEMPLATES = {}
def StructTemplate.new(template, *args)
klass = Struct.new(*args)
TEMPLATES[klass] = template.to_s
klass.class_eval do
def to_s
TEMPLATES[self.class].gsub(/\#\{(.*?)\}/) do
method($1).call.to_s if respond_to? $1
end
end
end
klass
end
end
You might have a file template that looks like this (let's call it
``page.tmpl''):
<html>
<head>
<title>#{title}</title>
</head>
<body>
#{content}
</body>
</html>
Then you could use it like this:
require 'cgi'
cgi = CGI.new
PageT = StructTemplate.new('page.tmpl', :title, :content)page = PageT.new
page.title = 'Hello World!'
page.content = 'Content goes here'
cgi.out {page}
Since StructTemplate#to_s calls #to_s on each member as it's being
substituted into the template, you can create fairly complex output by
nesting templates. If you have a page with many ``objects'' that are
alike (say, for instance, a weblog with multiple ``entries''), you can
create StructTemplates for those objects and pass an array of them to
the page template for its content.
It's not advanced by any means, but it's certainly simple and
relatively easy to use.
Robert
Sam
On Mon, 2 Aug 2004 05:06:39 +0900, Robert <catcher@linuxmail.org> wrote:
Speaking of that, the current CVS HEAD of Ruwiki has a heavily
modified version of the Template module from Rdoc (I think they're
similar; if they have !INCLUDE! directives, they probably arte) that
you may want to play with. I actually think that the modified version
has some neat features (labels vs. variables, optional labels and
names, inline if/ifnots and repeats).
-austin
On Mon, 2 Aug 2004 05:39:56 +0900, David A. Black <dblack@wobblini.net> wrote:
Hi --
On Mon, 2 Aug 2004, Robert wrote:
> What do you use when programming Ruby/CGI? Do you just use straight Ruby or
> do you use any templating modules?I've made a lot of use of the Template module from RubLog.
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca
You can actually even just use rdoc, as included in ruby 1.8.1+. A
simplistic example can be seen here:
Chad
On Mon, 2 Aug 2004 05:39:56 +0900, David A. Black <dblack@wobblini.net> wrote:
Hi --
On Mon, 2 Aug 2004, Robert wrote:
> What do you use when programming Ruby/CGI? Do you just use straight Ruby or
> do you use any templating modules?I've made a lot of use of the Template module from RubLog.
> What do you use when programming Ruby/CGI? Do you just use straight Ruby
or
> do you use any templating modules?
>
> I am running Apache on Windows XP.
I personally use Iowa. Iowa is an object based web application & dynamic
content framework that runs on both *nix and Windows platforms. It features
seperation of code from layout. In that contiuum it inhabits a place
somewhere between Rails and CGIKit, with much greater seperation than Rails,
but less forced seperation than CGIKit requires.
Iowa templates are simple. They are straight HTML with a small amount of
very simple but flexible special markup. Templates create components, and
components are embedable in other components. In this way one can create
reusable widgets.
i.e. a conditional:
<if oid="has_user?"><p>Welcome @user!</p></if>
It can be found at http://rubyforge.org/projects/iowa
Anyway, it is what I use. I've been using it for over two years on a
variety of successful production web sites and web based applications from
small to large.
If you want to check it out, it's at Rubyforge:
http://rubyforge.org/projects/iowa
Feel free to email me with any question.
Kirk Haines
A brief example using RDoc is on Dave Thomas's blog-
http://pragprog.com/pragdave/Tech/Ruby/RssHead.rdoc
Nick
Chad Fowler wrote:
On Mon, 2 Aug 2004 05:39:56 +0900, David A. Black <dblack@wobblini.net> wrote:
Hi --
On Mon, 2 Aug 2004, Robert wrote:
What do you use when programming Ruby/CGI? Do you just use straight Ruby or
do you use any templating modules?
I've made a lot of use of the Template module from RubLog.
You can actually even just use rdoc, as included in ruby 1.8.1+. A
simplistic example can be seen here:Chad