Hello

I've had some troubles when child templates need to provide some content 
for the parent templates. 

My first approach was setting $var in child template, and access it from 
parent template. But this approach has obvious limitation: you cannot 
provide more complex content than just one string (yes you can by setting 
$var to sub-sub-template output, but this is not flexible).

Instead of this I implemented a special content_for code block, that 
outputs contents to web.ctx, so then parent templates may output them.

Child template:

    $content_for("header"):
>         <p>Some content for header</p>


Parent template:

    $:content_for("header")



I've put the code in this issue 
https://github.com/webpy/webpy/issues/192#issuecomment-10693336
My first implementation was dirty, but then I found out how to make it 
nicer by hiding functionality in generated template code

I'm not sure if this feature can make its way in web.py code, but I'd like 
to get some feedback from web.py users.


-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/I75viHDXAIQJ.
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.

Reply via email to