Christopher Heschong | 12 Apr 18:54

option select in petal - ideas?

Lets say you have a select statement:

<select name="foo">
 <option tal:repeat="foo bar"
         tal:contents="foo/content"
         tal:attributes="selected foo/selected">option</option>
</select>

The problem is that there is no way for Petal to eliminate the selected
attribute if foo/selected returns false.  This is a problem because
selected="(anything)" causes the browser to assume that the option is
selected... the selected attribute must not exist at all in order for it
to not be selected.

Is the only way to do this something like:

<select name="foo">
 <span tal:repeat="foo bar">
   <span tal:condition="true:foo/selected">
    <option selected tal:contents="foo/content">option</option>
   </span>
   <span tal:condition="false:foo/selected">
    <option tal:contents="foo/content">option</option>
   </span>
 </span>
</select>

I guess the simple way to put it is can Petal be told to not print
attributes whose values are false or (better yet) nonexistant?

(Continue reading)

Jean-Michel Hiver | 13 Apr 00:21

Re: option select in petal - ideas?

Hi Christopher,

Christopher Heschong wrote:
> Lets say you have a select statement:
> 
> <select name="foo">
>  <option tal:repeat="foo bar"
>          tal:contents="foo/content"
>          tal:attributes="selected foo/selected">option</option>
> </select>
> 
> The problem is that there is no way for Petal to eliminate the selected
> attribute if foo/selected returns false.

Petal should remove the attribute if foo/selected returns undef.

Cheers,
Jean-Michel.

Joachim Zobel | 17 Apr 20:41
Picon
Favicon

entity euro hurts

Hi.

I am using 2.05 I have got &nbsp; to work by using 
	input        => 'HTML',
	output       => 'HTML',
but if I use &euro; or &#8364; it turns to  Â, while &euro; turns to
€.

What is going on here?

Sincerely,
Joachim

--

-- 
"... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden 
koennen."                            - Bertolt Brecht - Leben des Galilei 

Michele Beltrame | 18 Apr 21:48
Gravatar

Re: entity euro hurts


> I am using 2.05 I have got &nbsp; to work by using 
> 	input        => 'HTML',
> 	output       => 'HTML',
> but if I use &euro; or &#8364; it turns to  Â, while &euro; turns to
> â???¬.

I have the same problem, that's why I have to avoid using "&euro;" for
now. :-(

I'm just using output => 'XHTML' and leave the rest as per default.
"&nbsp;" works until I insert an "&euro;", after which no entity
seems to work anymore until I remove it.

	Michele.

--

-- 
Michele Beltrame
http://www.italpro.net/mb/
ICQ# 76660101 - e-mail: mb-pzZ8rf8/VxTR7s880joybQ==@public.gmane.org

Mark Holland | 19 Apr 01:41

Re: entity euro hurts

Michele Beltrame wrote:

>>I am using 2.05 I have got &nbsp; to work by using 
>>	input        => 'HTML',
>>	output       => 'HTML',
>>but if I use &euro; or &#8364; it turns to  Â, while &euro; turns to
>>â???¬.
>>    
>>
>
>I have the same problem, that's why I have to avoid using "&euro;" for
>now. :-(
>
>I'm just using output => 'XHTML' and leave the rest as per default.
>"&nbsp;" works until I insert an "&euro;", after which no entity
>seems to work anymore until I remove it.
>  
>
Try making sure all your output is unicode and that your browser is 
aware of this by setting your http content-type header to:

Content-type: text/html; charset=utf-8

and adding the following meta tag to your html (as some browsers don't 
honour/recognise the charset portion of the content-type header)

<meta http-equiv="content-type" content="text/html" charset=utf-8"/>

 I tried the &euro; entity on my system with this set up and it produces 
the character with no problems.
(Continue reading)

Mark Holland | 19 Apr 01:43

Re: entity euro hurts

Mark Holland wrote:

> and adding the following meta tag to your html (as some browsers don't 
> honour/recognise the charset portion of the content-type header)
>
> <meta http-equiv="content-type" content="text/html" charset=utf-8"/>

bah. that should be a semicolon, not a double quote, like so:

<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

time for bed methinks.

~mark

Michele Beltrame | 19 Apr 09:53
Gravatar

Re: entity euro hurts

Hi!

> Try making sure all your output is unicode and that your browser is 
> aware of this by setting your http content-type header to:
> 
> Content-type: text/html; charset=utf-8

Actually, all my templates are in 'latin1'. Is this a thing to be
avoided? If so, why?

	Thanks, Michele.

--

-- 
Michele Beltrame
http://www.italpro.net/mb/
ICQ# 76660101 - e-mail: mb-pzZ8rf8/VxTR7s880joybQ==@public.gmane.org

Mark Holland | 20 Apr 01:42

Re: entity euro hurts

Michele Beltrame wrote:

>
>Actually, all my templates are in 'latin1'. Is this a thing to be
>avoided? If so, why?
>  
>
Well I've switched everything to unicode because I could never seem to 
successfully encode the output from Petal into latin1. I've never really 
had time to investigate, I just know unicode works for me.

Joachim Zobel | 25 Apr 00:09
Picon
Favicon

Other TAL implementations?

Hi.

What other TAL implementations do exist (except for PHPTAL)? Is there a
Javascript implementation to do client side template expansion? Is there
an implementation using XSLT?

Thanx,
Joachim   

--

-- 
"... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden 
koennen."                            - Bertolt Brecht - Leben des Galilei 

Jean-Michel Hiver | 25 Apr 11:56

Re: Other TAL implementations?

Joachim Zobel wrote:
> Hi.
> 
> What other TAL implementations do exist (except for PHPTAL)? Is there a
> Javascript implementation to do client side template expansion? Is there
> an implementation using XSLT?

 From http://zope.org/Wikis/DevSite/Projects/ZPT/TAL/FrontPage

Non-Zope Implementations

Page Templates, or subsets such as TAL, have now been implemented in 
several languages. There are also Python re-implementations that are 
independent of Zope:

     * Perl: Jean-Michel Hiver's PETAL
     * PHP: Laurent Bedubourg's PHPTAL
     * Java: Stefano Masini's Java ZPT
     * Java: Chris Rossi's JPT
     * Python: Colin Stewart's Simple TAL
     * Python: Lalo Martins' Open TAL
     * Python: Kevin Smith's Sourceforge Project


Gmane