Having multiple patterns nested with weby

I created a website using webpy. I have a main page called layout.html. I load foo1.html into the layout

$def with (content) <html> <head> <title>Foo</title> </head> <body> $:content </body> </html> 

And the content inside is foo1.html

 <div> Hello </div> 

Is it possible to change foo1.html to load another webpage:

 $def with (secondarycontent) <div> $:secondarycontent </div> 
+4
source share
1 answer

Just define render as a global template

 template_globals = {} render_partial = template.render(template_dir, globals=template_globals) render = template.render(template_dir, globals=template_globals, base='layout') template_globals.update(render=render_partial) 

So now you can call it from templates

 $:render.nested.template() 
+1
source

Source: https://habr.com/ru/post/1488902/


All Articles