[Zope] My first question.
Goldthwaite, Joe
joe at goldthwaites.com
Wed Dec 3 16:58:15 EST 2003
Son of a..., that worked! I don't understand it.
<b tal:omit-tag="python:item.Flags!='B'" tal:content="item/desc" />
Does this rely on the " />" at the end to close the B tag or does the tal
interpreter close it automatically?
Joe Goldthwaite
-----Original Message-----
From: Andrew Altepeter [mailto:aaltepet at bethel.edu]
Sent: Wednesday, December 03, 2003 2:42 PM
To: joe at goldthwaites.com
Subject: RE: [Zope] My first question.
> 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>
It's invalid xhtml to have <b><td>stuff</td></b>
Inside a table row, the only allowable elements are (correct me if I'm
wrong) td and th.
I would try something like (untested):
<td>
<b tal:omit-tag="python:item.Flags!='B'" tal:content="item/desc" />
</td>
This way, you're putting <b> inside the table cell. If item.Flags is
not 'b', then item/desc will not be 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.
It's actually fairly easy in TAL once you get the hang of it ;-)
> 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.
For complicated lists and such, I sometimes use python to generate the
html. Just use the best tool for the job.
> 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?
I think using zpt and/or DTML along with python gives you a better
design approach. You can see what each piece (presentation, business
logic) is doing better when they are separated!
HTH,
Andy
>
> Joe Goldthwaite
>
>
>
> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
> Paul Winkler
> Sent: Wednesday, December 03, 2003 11:52 AM
> To: zope at 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 at 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 )
>
>
> _______________________________________________
> Zope maillist - Zope at 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 )
More information about the Zope
mailing list