Hi, In the manual, there is exactly the case I want : Show an attribute with a specific value or don't show the attribute. The example speak about an attribute class="odd" : http://phptal.motion-twin.com/manual/en/#tal-attributes
The manual said : > <tr tal:repeat="ranking playerRankings" > tal:attribute="class php: repeat.ranking.odd ? 'odd' : false"> > ... > </tr> > > > The php: modifier will be explained later, basically if the line is > odd then tr will have a class attribute with "odd" as value, > otherwise, no class attribute will be set. But this doesn't works like said in the manual. If the php condition return false, this put in the template : class="0" And the manual said this should not add the class attribute ?! The manual also explain this could be more quick if we write a custom modifier, but my tests have discover another bug in the manual : http://phptal.motion-twin.com/manual/en/#id469418 The manual said we can uses the phptal_tales_path() function to parse the path, but this fonction doesn't exists. There is another function named phptal_path() but this seems different to uses. Is anyone have tried to make a custom modifier ? If yes, can you put it an example please ? Thanks for your help. Le samedi 26 avril 2008 à 23:07 +0200, Guillaume Lecanu a écrit : > Le samedi 26 avril 2008 à 19:34 +0200, Iván -DrSlump- Montes a > écrit : > > > I think to recall that PHPTAL knows about 'boolean' attributes like > > 'checked' and 'selected'. Have you tried something like this? > > > > <input type="checkbox" name="agreement" value="1" > > tal:attributes="checked agreement" /> > > Hi Iván, > > This put a checked="" in the 'false' case. > And this check the box on some browsers. > But I have may be found a solution with custom modifiers. > > Thanks > > > > > > iván > > > > On Sat, Apr 26, 2008 at 6:57 PM, Guillaume Lecanu <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > > How is it possible to remove an attributes (or to add it) depending of a > > > value/condition ? > > > > > > > > > If ($agreement) { > > > > > > <input type="checkbox" name="agreement" value="1" checked="checked" /> > > > > > > } else { > > > > > > <input type="checkbox" name="agreement" value="1" /> > > > > > > } > > > > > > Thanks ! > > > _______________________________________________ > > > 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
_______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal