[Twisted-web] Nested templates?

Alberto Trujillo alberto.trujillo at ucd.ie
Fri Jul 8 10:24:10 MDT 2005


Donovan Preston wrote:

>
> On Jul 7, 2005, at 9:22 AM, Alberto Trujillo wrote:
>
>> There is any way to use nested templates without mix the python  code 
>> with the html code.
>> I know, that I could solve this problem using Stan, or just writing  
>> html code inside the python file and after display what I want.
>> But that are exactly the option that I can't use. I have to nest  the 
>> template keeping the html code and the python code in different  file.
>> If some body can give a example, a tutorial, a address, o something  
>> that can help me, I'll be very pleasant.
>>
>> Thank you very much
>
>
> It's not very hard. There is a class in nevow.rend specifically for  
> this purpose, nevow.rend.Fragment. It is one of Page's superclasses.  
> It doesn't do much but load a docFactory and render it. Here is an  
> example of using it.
>
> Let me know if this isn't enough help.
>
> Donovan
>
>------------------------------------------------------------------------
>
><html xmlns:n="http://nevow.com/ns/nevow/0.1">
>    <head>
>        <title>This is a page.</title>
>    </head>
>    <body>
>        <h1>This is a page.</h1>
>        Here are some subtemplates:
>        <div n:data="one" n:render="sub" />
>        <div n:data="two" n:render="sub" />
>    </body>
></html>
>  
>
>------------------------------------------------------------------------
>
><div xmlns:n="http://nevow.com/ns/nevow/0.1">
>    This is a subtemplate. <n:invisible n:render="something" />
></div>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Twisted-web mailing list
>Twisted-web at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>  
>
Hey, thanks again one more time. It's very cool the example that you 
send me here. I was working with and is what I need.
Thanks as well to the rest of the people that has help me with these 
problems (even with the call of the child)



More information about the Twisted-web mailing list