-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Szymek Przybył wrote:
> I have some problem with chain of strings and php variable in
> tal:attributes:
> 
> <a tal:attributes="class php:ligaInfo['liga']==1?'blank':false;href
> php:ligaInfo['liga'] GT
> 1?string:/league/${php:ligaInfo['liga']-1}/1:false">

Hi, If I were you, I'd make a function out of this:

function getClass($liga) {
if ($liga == 1 ) return 'blank';
return false;
}

<a tal:attributes="class php:getLink(ligaInfo['liga'])">

And the same for the other attribute.

It is hard to get this right with more than one attribute and many
conditionals. Better move it out of the template.

Also, I've experienced that php paths must be one one line or they fail.

Regards,
Tarjei


> 
> And if ligaInfo['liga'] is greater than 1, this <a> have a href - eg.
> 'league/1/1' (otherwise - not). PHPTAL gives me an error:
> Parse error: syntax error, unexpected '/' in /tmp/tpl_blablablabla....
> 
> Where I done a mistake?
> 
> cheers!
> szymek
> 
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJfFdDYVRKCnSvzfIRAm3LAKCwQ0EAYAUnKTMD0ayY0XN4puL/GACfeOPR
xGBiIeT0mrbgWrRtf/hyTO0=
=3EvW
-----END PGP SIGNATURE-----

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

Reply via email to