Re: [Zope-dev] Repeating a piece of HTML code

2000-06-02 Thread Shane Hathaway

Alex Mendez wrote:
 
 Hello, it's the first time I write here and I'm a
 newbie at Zope, so maybe I'm asking a stupid
 question...
 
 Case is I retrieve from my movie database the value of
 the movie from 1 to 5 stars. I would like to repeat
 that n times the code img SRC="star.gif" height=15
 width=15 so the number of stars would appear:
 
 1 - *
 2 - **
 3 - ***
 4 - 
 5 - *
 
 Is there any way to do so in Zope? Does the dtml-in
 tag anything to do with it?

dtml-in expr="_.range(0, movie_rating)"
  img SRC="star.gif" height=15 width=15
/dtml-in

Replace movie_rating with the variable that represents the movie rating.

Shane

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Repeating a piece of HTML code

2000-06-02 Thread Steve Alexander

Shane Hathaway wrote:
 
 Alex Mendez wrote:
 
  Hello, it's the first time I write here and I'm a
  newbie at Zope, so maybe I'm asking a stupid
  question...
 
  Case is I retrieve from my movie database the value of
  the movie from 1 to 5 stars. I would like to repeat
  that n times the code img SRC="star.gif" height=15
  width=15 so the number of stars would appear:
 
  1 - *
  2 - **
  3 - ***
  4 - 
  5 - *
 
  Is there any way to do so in Zope? Does the dtml-in
  tag anything to do with it?
 
 dtml-in expr="_.range(0, movie_rating)"
   img SRC="star.gif" height=15 width=15
 /dtml-in
 
 Replace movie_rating with the variable that represents the movie rating.

What about dtml-var "'*' * movie_rating" ?

--
Steve Alexander
Software Engineer
Cat-Box limited

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Repeating a piece of HTML code

2000-06-02 Thread Steve Alexander

Steve Alexander wrote:
 
 Shane Hathaway wrote:
 
  dtml-in expr="_.range(0, movie_rating)"
img SRC="star.gif" height=15 width=15
  /dtml-in
 
  Replace movie_rating with the variable that represents the movie rating.
 
 What about dtml-var "'*' * movie_rating" ?

Or rather:

  dtml-var "'img SRC=star.gif height=15 width=15' * movie_rating"

--
Steve Alexander
Software Engineer
Cat-Box limited

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Repeating a piece of HTML code

2000-06-02 Thread Jim Sanford

if  number_of_stars is 5 then

dtml-var " '*' * number_of_stars "

will give you *

(Multiplication works on strings in python and thus Zope!)

Jim Sanford

- Original Message - 
From: "Alex Mendez" [EMAIL PROTECTED]
To: "Lista Zope" [EMAIL PROTECTED]
Sent: Friday, June 02, 2000 5:28 AM
Subject: [Zope-dev] Repeating a piece of HTML code


Hello, it's the first time I write here and I'm a
newbie at Zope, so maybe I'm asking a stupid
question...

Case is I retrieve from my movie database the value of
the movie from 1 to 5 stars. I would like to repeat
that n times the code img SRC="star.gif" height=15
width=15 so the number of stars would appear:

1 - *
2 - **
3 - ***
4 - 
5 - *

Is there any way to do so in Zope? Does the dtml-in
tag anything to do with it?

Thank you!

=
Saludos!!   
 _-/Txapulin\-_
[EMAIL PROTECTED]  O  \  /   ---\  /  O
http://www.geocities.com/txapulin   \/ |  \/
/  |XAP\
 ||
 ||

__
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Repeating a piece of HTML code

2000-06-02 Thread Duncan Booth

  dtml-in expr="_.range(0, movie_rating)"
img SRC="star.gif" height=15 width=15
  /dtml-in
  
  Replace movie_rating with the variable that represents the movie rating.
 
 What about dtml-var "'*' * movie_rating" ?
 

Fine, except that he wants the img tag repeated the appropriate 
number of times. Try putting the tag into the dtml-var statement 
and you get something along the lines of (untested):

  dtml-var "('img src=%sstart.gif%s height=15 width=15' % 
(_.chr(34), _.chr(34))) * movie_rating"

at which point the dtml-in starts to look more appealing.

Of course if you rename star.gif as star_gif you could try:
 dtml-var "start_gif.tag() * movie_rating"
which has a certain neatness.


-- 
Duncan Booth [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )