You have to use ${ name } and not { $name }
nolsen01 wrote:
> I'm following the book at pylonsbook.com. I've created a project
> called "TemplateDemo" and when I create a template "greeting.html" and
> call it with render(), instead of replacing {$name} with the value of
> the variable I've passed, it simply shows greeting.html with the
> {$name} in it. Its has if I'm viewing the html file statically.
>
> Here is my controller code:
>
>
> import logging
>
> from pylons import request, response, session, tmpl_context as c
> from pylons.controllers.util import abort, redirect_to
>
> from templatedemo.lib.base import BaseController, render
>
> log = logging.getLogger(__name__)
>
> class GreetingController(BaseController):
>
> def index(self):
> name = 'Pylons Developer'
> return render('/greeting.html', extra_vars={'name' : name})
>
>
> and here is my greeting.html code:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>Greetings</title>
> </head>
> <body>
> <h1>Greetings</h1>
> <p>Hello {$name}!</p>
> </body>
> </html>
>
> What gives?
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---