psycat
psycat

Reputation: 513

webpy template multiple inheritance, possible?

I want to divide index page into small stand alone .html parts like:

up_bar.html:
<p><center> <h1>home</h1> Menu: <a href="/">home</a> <a href="add">add</a> <a href="/import">import</a>

down_bar.html:
<a href="/path/.."/>
and so on.

Now, to build a new page is it possible to embed those pieces into other page using default webpy templator?

Maybe something like that?:
in admin.html:
$def with(some_parameters):
<title>Admin panel</title>
$include('side_bar.html')
... body stuff ...
$include('down_bar.html')

Upvotes: 1

Views: 993

Answers (3)

Ahmad Muzakki
Ahmad Muzakki

Reputation: 1088

I did this to my code

def GET(self,*args):
    param= {'name':'jackie'}
    view = web.template.frender("views/someview.html")
    content = view(**param)
    layout = web.template.frender("views/index.html")
    return layout(content=content)

now you just insert $:content in index.html

Upvotes: 0

DrDee
DrDee

Reputation: 3609

A basic but good introduction to template inheritance can be found here: http://webpy.org/cookbook/layout_template

Upvotes: 1

psycat
psycat

Reputation: 513

Found an answer here:
http://groups.google.com/group/webpy/msg/ea6da02dfb9eedc4?dmode=source
Some explanation will be great.

Upvotes: 0

Related Questions