SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pylons and Mako help

    I've created a project call TemplateDemo. When I visit the page (/greeting/index/) it shows the variable as {$name} instead of as the variable I created in the code. Here is my controller code:

    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:

    Code:
    <html>
    <head>
        <title>Greetings</title>
    </head>
    <body>
        <h1>Greetings</h1>
        <p>Hello {$name}!</p>
    </body>
    </html>
    What gives? Its as if the template isn't being rendered.

  2. #2
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It was a simple syntax error.

    {$name} is wrong
    ${name} is correct.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •