Karrigell/Insert dynamic values in a template

      The templating system uses Python string formatting

      Create a template called page.tmpl :

      <html>
      <head>
      <title>{title}</title>
      </head>
      <body>
      Hello {name}
      </body>
      </html>
      

      then edit index.py and add this function :

      def bar(name):
          return Template('page.tmpl',title='template test',name=name)
      

      Enter http://localhost/index.py/bar?name=Joe to see how the templating engine replaced the placeholders {title} and {name} by the values passed to the function Template

      Last modified on 22 February 2011, at 19:01