Skip to content

Commit

Permalink
explain the dict style
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Sep 24, 2009
1 parent 9d84116 commit 04e852b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Expand Up @@ -74,6 +74,37 @@ Which returns the following:

Simple.

Dict-Style Views
----------------

ctemplate and friends want you to hand a dictionary to the template
processor. Naturally rtemplate supports a similar concept. Feel free
to mix the class-based and this more procedural style at your leisure.

Given this template (dict.html):

Hello {{name}}
You have just won ${{value}}!

We can fill in the values at will:

dict = Dict.new
dict[:name] = 'George'
dict[:value] = 100
dict.to_html

Which returns:

Hello George
You have just won $100!

We can re-use the same object, too:

dict[:name] = 'Tony'
dict.to_html
Hello Tony
You have just won $100!

Helpers
-------

Expand Down

0 comments on commit 04e852b

Please sign in to comment.