Ok I'll look into the METAL stuff. I skimmed over it but it looked confusing and didn't seem to apply to my current problems. I guess it's time to give it another look-see. By the way, I checked my line and it does have the structure statement in. Here's the page; <html> <head> <title tal:content="template/title">The title</title> </head> <body> <h2><span tal:condition="template/title" tal:replace="template/title">optional template id</span></h2> *** <span tal:replace="structure here/IS_YTD_Header"></span> *** <tr tal:repeat="item python:here.GetISLines(FY=request.FY, Per=request.Per, OrgType=request.OrgType, OrgNo=request.OrgNo)"> <td tal:content="item/desc">desc</td> <td tal:content="item/YtdCurrent" style="text-align: right"></td> <td tal:content="item/YtdLastYear" style="text-align: right"></td> <td tal:content="item/YtdPlan" style="text-align: right"></td> <td tal:content="item/YtdPcntVariance" style="text-align: right"></td> <td tal:content="item/YtdPcntVariancePlan" style="text-align: right"></td> <td tal:content="item/YtdVariance" style="text-align: right"></td> <td tal:content="item/YtdVariancePlan" style="text-align: right"></td> </tr> <span tal:replace="structure here/IS_Ptd_Footer"></span> </body> </html> The highlights show the standard header that is a separate ZPT. I misspoke when I said that the result comes out quoted. The header comes out looking beautiful. It's the rest of the document that gets quoted. If I change IS_YTD_Header with IS_Ptd_Header, the non-header part of the page comes out correct. The only difference is the IS_YTD_Header is a ZPT and IS_Ptd_Header is a DTML method. Can someone explain that??? Joe Goldthwaite I'm having more fun than should be allowed! -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Paul Winkler Sent: Wednesday, December 03, 2003 10:39 AM To: zope@zope.org Subject: Re: [Zope] My first question. On Wed, Dec 03, 2003 at 10:01:08AM -0700, Goldthwaite, Joe wrote:
My first question got lost in all the discussion of the second. I'm going to repost it in hopes of getting lucky.
In order to keep my table headers consistent across reports, I have them stored as a separate DTML method called IS_Ptd_Header. In my main Income Statement, I have this where I want the table header to show up;
<span tal:replace="structure here/IS_Ptd_Header"></span>
This works fine. The problem I've run into is when I want to use tal tags in the IS_Ptd_header like this;
Income Statement for period <span tal:replace="request/Per">Period</span>
If I have this line in the Income Statement ZPT it works. I get the "Per" parameter from the URL. When the same line in IS_Ptd_Header gets ignored so the resulting page shows "Income Statement for period Period". I thought that maybe the tal tags were being ignored because IS_Ptd_Header is a DTML method
Correct. DTML and ZPT are completely different.
so I created a ZPT with the name IS_YTD_Header and used that in the tal replace command but the result came back as HTML quoted text instead of the actual HTML. Anyone know what I'm missing?
Yes. Output of tal statements is normally html quoted. You probably left out the "structure" directive: <span tal:replace="structure here/IS_YTD_Header"></span>
It doesn't look like ZPT is designed to work this way. For my footer, (for now) I just have the </table> tag to finish my table. The ZPT gives me a mismatched tag error.
Right. Each Page TEmplate is normally required to be valid XML. You *can* disable this. I forget how because I never do it :-) But it's in the zope book, first Page TEmplates chapter.
What's the best way to modularize the web pages?
METAL. See zope book, Advanced Page Templates chapter. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's SUPER-DE-DOOPER KILLJOY IZER! (random hero from isometric.spaceninja.com) _______________________________________________ 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 ) Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com.
On Wed, Dec 03, 2003 at 10:52:35AM -0700, Goldthwaite, Joe wrote:
Ok I'll look into the METAL stuff. I skimmed over it but it looked confusing and didn't seem to apply to my current problems.
It's just a different way to work, requires a somewhat different mindset. (snip)
The highlights show the standard header that is a separate ZPT. I misspoke when I said that the result comes out quoted. The header comes out looking beautiful. It's the rest of the document that gets quoted. If I change IS_YTD_Header with IS_Ptd_Header, the non-header part of the page comes out correct. The only difference is the IS_YTD_Header is a ZPT and IS_Ptd_Header is a DTML method. Can someone explain that???
Nope. It's odd. If I were in your place I would start by inspecting the rendered HTML and see what's different between the two versions, then try to deduce the cause(s).
Joe Goldthwaite I'm having more fun than should be allowed!
Good, that'll help you get through these initial difficulties :-) -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's AGNOSTIC SPACE GRID ORIGINATOR! (random hero from isometric.spaceninja.com)
Mystery solved. I looked at the html source like you suggested and it looked fine. It's not quoting the rest of the page. What's happening is the IS_YTD_Header is a TABLE column header. When I put the DTML method in as a ZPT, it automatically closed the table tag. Now all the data that would have been in the table is being strung together in one big string that looks a lot like quoted html. I guess the ZPT stuff is trying to help me by forcing the closing tags but I wish it wouldn't. Its help is getting in the way. Here's another problem that seems to be related. Maybe someone can show me a good way of doing it. I have a flag coming in from my data that indicates whether or not to make the line bold. The only way I know of to make it bold is to put <b> and </b> tags around the text. I tried using a tal:condition statement in my repeat loop like this; <p tal:condition="python:item.Flags == 'B'" tal:omit-tag=""><b></p> <td tal:content="item/desc">desc</td> <p tal:condition="python:item.Flags == 'B'" tal:omit-tag=""></b></p> The idea being that I'd put the <b> before and </b> after my description. I used the tal:omit-tag to take out the <p> so it wouldn't screw things up. I get a compilation failed message on the </b>. If I take the last line out, It compiles but the html puts the closing </b> tag right after the <b>. It's like it sees the closing </p>, (even though it's omitted) and knows the </b> isn't there so it puts it there. Of course nothing comes out bold. This is trivial to do in Python. I know I'm supposed to separate presentation from logic but doing the formatting in HTML or TAL seems so much harder. I'm starting to think it may be better to just return the HTML from my function all ready to display. I can still separate the basic logic from the presentation. The presentation logic will just be in a Python formatting routine instead of as objects in Zope. Will this cause me any problems down the road? We don't have separate HTML designers or teams working on this. It's just me. Maybe in my situation using ZTP and DTML just complicates things with no real benefit. Any ideas? Joe Goldthwaite -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Paul Winkler Sent: Wednesday, December 03, 2003 11:52 AM To: zope@zope.org Subject: Re: [Zope] My first question. On Wed, Dec 03, 2003 at 10:52:35AM -0700, Goldthwaite, Joe wrote:
Ok I'll look into the METAL stuff. I skimmed over it but it looked confusing and didn't seem to apply to my current problems.
It's just a different way to work, requires a somewhat different mindset. (snip)
The highlights show the standard header that is a separate ZPT. I misspoke when I said that the result comes out quoted. The header comes out looking beautiful. It's the rest of the document that gets quoted. If I change IS_YTD_Header with IS_Ptd_Header, the non-header part of the page comes out correct. The only difference is the IS_YTD_Header is a ZPT and IS_Ptd_Header is a DTML method. Can someone explain that???
Nope. It's odd. If I were in your place I would start by inspecting the rendered HTML and see what's different between the two versions, then try to deduce the cause(s).
Joe Goldthwaite I'm having more fun than should be allowed!
Good, that'll help you get through these initial difficulties :-) -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's AGNOSTIC SPACE GRID ORIGINATOR! (random hero from isometric.spaceninja.com) _______________________________________________ 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 )
On Wed, Dec 03, 2003 at 02:36:21PM -0700, Goldthwaite, Joe wrote:
Mystery solved. I looked at the html source like you suggested and it looked fine. It's not quoting the rest of the page. What's happening is the IS_YTD_Header is a TABLE column header. When I put the DTML method in as a ZPT, it automatically closed the table tag. Now all the data that would have been in the table is being strung together in one big string that looks a lot like quoted html. I guess the ZPT stuff is trying to help me by forcing the closing tags but I wish it wouldn't. Its help is getting in the way.
Here's another problem that seems to be related. Maybe someone can show me a good way of doing it. I have a flag coming in from my data that indicates whether or not to make the line bold. The only way I know of to make it bold is to put <b> and </b> tags around the text. I tried using a tal:condition statement in my repeat loop like this;
<p tal:condition="python:item.Flags == 'B'" tal:omit-tag=""><b></p> <td tal:content="item/desc">desc</td> <p tal:condition="python:item.Flags == 'B'" tal:omit-tag=""></b></p>
That's not valid nesting, hence the compilation error.
This is trivial to do in Python. I know I'm supposed to separate presentation from logic but doing the formatting in HTML or TAL seems so much harder. I'm starting to think it may be better to just return the HTML from my function all ready to display.
better to learn how to use ZPT :-) Here's one solution: ... <td> <b tal:omit-tag="python:item.Flags !='B'" tal:content="item/desc"> Description of the item </b> </td> ... Here's another solution, using css classes: <head> ... <style type="text/css"> .darker {font-weight: bold} </style> ... </head> <body> ... <td> <span tal:class="python:item.Flags=='B' and 'darker' or nothing" tal:content="item/desc"> Description of the item </span> </td> ... </body> -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's FUZZY TROMBONIST BLOODLOSS! (random hero from isometric.spaceninja.com)
Paul Winkler wrote> better to learn how to use ZPT :-) I guess you're right. Since I have such a short time line it's tempting to just get it done the quickest way without learning ZPT. If I don't really learn it, I won't know when it's the best tool. That goes for everything. I do wish it was all simpler. Thanks again everyone for all your help. Joe Goldthwaite
participants (3)
-
Goldthwaite, Joe -
Goldthwaite, Joe -
Paul Winkler