1

I would like to use defined variables by phptal within php conditions as follows :

...
<tal:block define="className php: (photoIndex < 10) ? 'thumbItem thumbColumn1' : ( (photoIndex == 10) ? 'thumbItem thumbColumn2 thumbReset' : 'thumbItem thumbColumn2' )">
<tal:block define="defaultVal photo/isDefault">
<tal:block define="classNameWithIndex php: defaultVal ? '${className} modalMegaPhotoSelect' : '${className}'">
<li tal:attributes="class classNameWithIndex">
...

Here my output is "${className} modalMegaPhotoSelect" where as I expect it to be as "thumbItem thumbColumn1 modalMegaPhotoSelect" - the exact expectation is irrelevant the idea is the className should be percieved as a variable -

Thanks for your time.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Pumpkin
  • 1,993
  • 3
  • 26
  • 32

1 Answers1

0

Instead of '${className}' simply use className.

Instead of '${className} modalMegaPhotoSelect' use className . ' modalMegaPhotoSelect' (with spaces around .).

Kornel
  • 97,764
  • 37
  • 219
  • 309