Re: [PHPTAL] tal:attributes question

2010-03-23 Thread Tjerk Meesters
Hi,

Just checking up on this as a feature request, as it does sound interesting.

Technically it shouldn't conflict, as just passing a single argument
as tal:attributes would otherwise throw an error; an additional check
to see if the argument is an array sounds harmless ;-)


Best,
  Jack

On Sat, Mar 13, 2010 at 4:48 AM, Christina Van Dyke  wrote:
> I agree. After reading another
> post(http://lists.motion-twin.com/pipermail/phptal/2008-January/000890.html),
> it seems there is no support for this. As a workaround, I'm looking into
> prefilters right now. Hopefully I can write a prefilter that does what I
> need.
>
> On Fri, Mar 12, 2010 at 3:42 PM, Tjerk Meesters 
> wrote:
>>
>> Maybe not via a string but being able to pass attributes using an array
>> with the keys being attribute names would be handy.
>>
>>
>> On 13-Mar-2010, at 4:12, Christina Van Dyke  wrote:
>>
>>> I know you can assign attributes to a tag by doing this: >> tal:attributes="class string:myclass; id string:myid;">text
>>>
>>> What I want to do is pass a variable to the template that contains all
>>> the attributes in one string. Example:
>>>
>>> $my_attributes = "class string:myclass; id string:myid;";
>>>
>>> text
>>>
>>> This doesn't work. Anyone know why, or have a workaround?
>>>
>>> Thanks,
>>> Christina
>>>
>>> ___
>>> PHPTAL mailing list
>>> PHPTAL@lists.motion-twin.com
>>> http://lists.motion-twin.com/mailman/listinfo/phptal
>>
>> ___
>> PHPTAL mailing list
>> PHPTAL@lists.motion-twin.com
>> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>



-- 
--
Tjerk

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question - reducing this statement

2010-03-23 Thread Kornel Lesinski
On 22 Mar 2010, at 20:00, romtek wrote:

> It (true:) will be very helpful. I've resorted to PHP in cases when "true:" 
> would've been useful. Has it been available for a long time?

Yes, but it's PHPTAL's extension (not part of Zope's TALES).

-- 
regards, Kornel


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question - reducing this statement

2010-03-22 Thread romtek
It (true:) will be very helpful. I've resorted to PHP in cases when "true:"
would've been useful. Has it been available for a long time?


On Mon, Mar 22, 2010 at 5:49 AM, Kornel Lesinski  wrote:

> On 20 Mar 2010, at 04:35, romtek wrote:
>
> > function phptal_tales_erorrclass($fieldname, $nothrow)
> > {
> >   return phptal_tales('true:error/'.$fieldname, $nothrow)." ? 'error' :
> NULL";
> > }
> >
> > 
> >
> >
> > I've noticed "true:" there. Is "true" one of PHPTALES? (It's not
> documented at http://phptal.org/manual/en/#phptales.) If so, are there
> other undocumented ones? If not, then would you please explain how this code
> works?
>
> It's equivalent of PHP's !empty(), i.e. checks if variable exists and
> evaluates to true. I've added it to documentation in SVN and push it live on
> next update.
>
> --
> regards, Kornel
>
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question - reducing this statement

2010-03-22 Thread Kornel Lesinski
On 20 Mar 2010, at 04:35, romtek wrote:

> function phptal_tales_erorrclass($fieldname, $nothrow)
> {
>   return phptal_tales('true:error/'.$fieldname, $nothrow)." ? 'error' : NULL";
> }
> 
> 
> 
> 
> I've noticed "true:" there. Is "true" one of PHPTALES? (It's not documented 
> at http://phptal.org/manual/en/#phptales.) If so, are there other 
> undocumented ones? If not, then would you please explain how this code works?

It's equivalent of PHP's !empty(), i.e. checks if variable exists and evaluates 
to true. I've added it to documentation in SVN and push it live on next update.

-- 
regards, Kornel


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question - reducing this statement

2010-03-19 Thread romtek
2010/3/17 Kornel Lesiński 

> function phptal_tales_erorrclass($fieldname, $nothrow)
> {
>   return phptal_tales('true:error/'.$fieldname, $nothrow)." ? 'error' :
> NULL";
> }
>
> 
>


I've noticed "true:" there. Is "true" one of PHPTALES? (It's not documented
at http://phptal.org/manual/en/#phptales.) If so, are there other
undocumented ones? If not, then would you please explain how this code
works?
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question - reducing this statement

2010-03-17 Thread Kornel Lesiński

On 17-03-2010 at 16:21:20 Levi Stanley  wrote:


First Name:


Is there a better way to do this?


function phptal_tales_erorrclass($fieldname, $nothrow)
{
   return phptal_tales('true:error/'.$fieldname, $nothrow)." ? 'error' :  
NULL";

}



--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question

2010-03-12 Thread Christina Van Dyke
I agree. After reading another post(
http://lists.motion-twin.com/pipermail/phptal/2008-January/000890.html), it
seems there is no support for this. As a workaround, I'm looking into
prefilters right now. Hopefully I can write a prefilter that does what I
need.

On Fri, Mar 12, 2010 at 3:42 PM, Tjerk Meesters wrote:

> Maybe not via a string but being able to pass attributes using an array
> with the keys being attribute names would be handy.
>
>
>
> On 13-Mar-2010, at 4:12, Christina Van Dyke  wrote:
>
>  I know you can assign attributes to a tag by doing this: > tal:attributes="class string:myclass; id string:myid;">text
>>
>> What I want to do is pass a variable to the template that contains all the
>> attributes in one string. Example:
>>
>> $my_attributes = "class string:myclass; id string:myid;";
>>
>> text
>>
>> This doesn't work. Anyone know why, or have a workaround?
>>
>> Thanks,
>> Christina
>>
>> ___
>> PHPTAL mailing list
>> PHPTAL@lists.motion-twin.com
>> http://lists.motion-twin.com/mailman/listinfo/phptal
>>
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] tal:attributes question

2010-03-12 Thread Tjerk Meesters
Maybe not via a string but being able to pass attributes using an  
array with the keys being attribute names would be handy.



On 13-Mar-2010, at 4:12, Christina Van Dyke  wrote:

I know you can assign attributes to a tag by doing this: tal:attributes="class string:myclass; id string:myid;">text


What I want to do is pass a variable to the template that contains  
all the attributes in one string. Example:


$my_attributes = "class string:myclass; id string:myid;";

text

This doesn't work. Anyone know why, or have a workaround?

Thanks,
Christina

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal