How would I include a file as text/html in a ZPT page? This is a HTML beginners question as much as a Zope one but there may be a Zope-specific way of doing this also. For example, I offer the user an input box, and when there is a result of calculations there are supplied below it. Conceptually it would be: #include "input_form.html" if result <> 0: #include "result.html" You know what I mean. In the tutorial there is an example using the default header ... <dtml-var standard_html_header> but this is DTML and I'm trying to do it through ZPT. To include Zope files I thought I needed to know their extension but the extension is not displayed in Zope and I can't find the files on disk - I presume they are stored in the DB. I came to the conclusion that you refer to them as objects simply by name. TIA, Eddie,
From: "Edward Comber" <zope@comber.org>
but this is DTML and I'm trying to do it through ZPT.
That depends on what you want to include. To "include" more ZPT code you use macros. But to just include the rendering of something else, you use the tal:contents command.
To include Zope files I thought I needed to know their extension but the extension is not displayed in Zope and I can't find the files on disk - I presume they are stored in the DB. I came to the conclusion that you refer to them as objects simply by name.
Exactly.
Could you demo a simple macro to do it? I did use the tal: method but I want to include further HTML code in a ZPT file. When I have this as a file of type 'text/html' it is included rendered, e.g. <font face="Arial" size="2"> Appears in the browser literally as <font face="Arial" size="2"> and viewing the source shows <font face="Arial" size="2"> When I make the file to be included of type 'text', it produces an XML compilation error. Eddie. -----Original Message----- From: Lennart Regebro [mailto:regebro@nuxeo.com] Sent: 30 January 2004 14:03 To: Edward Comber; zope@zope.org Subject: Re: [Zope] #include ... From: "Edward Comber" <zope@comber.org>
but this is DTML and I'm trying to do it through ZPT.
That depends on what you want to include. To "include" more ZPT code you use macros. But to just include the rendering of something else, you use the tal:contents command.
To include Zope files I thought I needed to know their extension but the extension is not displayed in Zope and I can't find the files on disk - I presume they are stored in the DB. I came to the conclusion that you refer to them as objects simply by name.
Exactly.
If you're using tal:contents, you need to tell TAL not to excape html characters, like this: <span tal:contents="structure here/some_other_content" /> HTH, Andy On Fri, 2004-01-30 at 09:09, Edward Comber wrote:
Could you demo a simple macro to do it?
I did use the tal: method but I want to include further HTML code in a ZPT file. When I have this as a file of type 'text/html' it is included rendered, e.g.
<font face="Arial" size="2">
Appears in the browser literally as <font face="Arial" size="2">
and viewing the source shows
<font face="Arial" size="2">
When I make the file to be included of type 'text', it produces an XML compilation error.
Eddie.
-----Original Message----- From: Lennart Regebro [mailto:regebro@nuxeo.com] Sent: 30 January 2004 14:03 To: Edward Comber; zope@zope.org Subject: Re: [Zope] #include ...
From: "Edward Comber" <zope@comber.org>
but this is DTML and I'm trying to do it through ZPT.
That depends on what you want to include. To "include" more ZPT code you use macros. But to just include the rendering of something else, you use the tal:contents command.
To include Zope files I thought I needed to know their extension but the extension is not displayed in Zope and I can't find the files on disk - I presume they are stored in the DB. I came to the conclusion that you refer to them as objects simply by name.
Exactly.
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Actually I have that bit working It needed <div macro....> Very much a trial and error system this. Eddie. -----Original Message----- From: Edward Comber [mailto:comber@cix.co.uk] Sent: 30 January 2004 15:09 To: Lennart Regebro; Edward Comber; zope@zope.org Subject: RE: [Zope] #include ... Could you demo a simple macro to do it? I did use the tal: method but I want to include further HTML code in a ZPT file. When I have this as a file of type 'text/html' it is included rendered, e.g. <font face="Arial" size="2"> Appears in the browser literally as <font face="Arial" size="2"> and viewing the source shows <font face="Arial" size="2"> When I make the file to be included of type 'text', it produces an XML compilation error. Eddie. -----Original Message----- From: Lennart Regebro [mailto:regebro@nuxeo.com] Sent: 30 January 2004 14:03 To: Edward Comber; zope@zope.org Subject: Re: [Zope] #include ... From: "Edward Comber" <zope@comber.org>
but this is DTML and I'm trying to do it through ZPT.
That depends on what you want to include. To "include" more ZPT code you use macros. But to just include the rendering of something else, you use the tal:contents command.
To include Zope files I thought I needed to know their extension but the extension is not displayed in Zope and I can't find the files on disk - I presume they are stored in the DB. I came to the conclusion that you refer to them as objects simply by name.
Exactly.
participants (4)
-
Andrew Altepeter -
Edward Comber -
Edward Comber -
Lennart Regebro