web.render used to call a templating engine called Cheetah. As
webpy's own templating system became more mature, support for Cheetah
was dropped, but since many people had legacy code using Cheetah, the
function was left in.
If you just want to display static html, you probably don't want to
use a framework at all...you want Apache :-)
If you're just trying to play with web.py and want to output some
static html code, you should probably just use the template system as
described by Tzury and instead of writing a template, use plain html
(plain html will still render correctly). Using templates is the
preferred way to eventually generate dynamic content, so getting it
set up now will be a good investment in your time...
So, to recap what Tzury said...call in your webpy code:
render = web.template.render('templates/')
create a subdirectory called "templates", and put an html file in
there (say "index.html")
then, in your webpy code, do something like this:
def GET(self):
print render.index()
and this will return your index.html file.
Hope this helps you get started.
-Justin
On Sep 26, 11:30 am, "Ranganath s" <[EMAIL PROTECTED]> wrote:
> HI Tzury
>
> Thanks a lot, In couple of articles there is this method called web.render("
> index.html") mentioned to render the existing html page. i was trying
> initially that instead of templates. So now has it been removed, if so whts
> the simple way to render the existing html page without using templates.
>
> Thankk you
> Ranganath.S
>
> On 9/25/07, Tzury <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > > web.render('index.html') it gives error as render not found in
> > > module. I have downloaded webpy0.22 and working on python2.5 . Is
> > > that method obsolete or removed ? plz let me know at the earliest
>
> > At first you should define your render object initialized with
> > templates directory
>
> > e.g.
> > render = web.template.render('templates/')
>
> > Once you did so, you can call render.<template_file>
> > e.g.
> > for 'index.html' you call render.index()
>
> > Moreover, if you have menu.html, header.html, footer.html which you
> > want them to appear at all pages you may do the following:
>
> > render.index(render.menu(), render.header())
> > and your index may look like:
> > $def with (menu, header, form, ....)
> > <html>
> > < blah> </blah>
> > <body>
> > $:header
> > $:menu
> > <form>
> > $:form.render()
> > </form>
> > </body>
>
> --
> I blog athttp://iparams.com/blog
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---