[PHPTAL] optional attribute, based on another condition
Hello, I want the 'href' attribute to be skipped if $item['route'] is empty: a tal:content=php:tm._(item['title']) tal:attributes=href php:ro.gen(item['route'])/ the manual says attributes can be skipped with | nothing, but this is based on the attribute's value. Thanks! ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] optional attribute, based on another condition
On 30 Sep 2010, at 10:01, Ionut Matei wrote: Hello, I want the 'href' attribute to be skipped if $item['route'] is empty: a tal:content=php:tm._(item['title']) tal:attributes=href php:ro.gen(item['route'])/ the manual says attributes can be skipped with | nothing, but this is based on the attribute's value. With php: modifier NULL also works: tal:attribute=href php:item['route'] ? ro.gen(item['route']) : NULL -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] optional attribute, based on another condition
Thanks! I didn't thought that ?: can be used in php:. 2010/9/30 Kornel Lesiński kor...@aardvarkmedia.co.uk: On 30 Sep 2010, at 10:01, Ionut Matei wrote: Hello, I want the 'href' attribute to be skipped if $item['route'] is empty: a tal:content=php:tm._(item['title']) tal:attributes=href php:ro.gen(item['route'])/ the manual says attributes can be skipped with | nothing, but this is based on the attribute's value. With php: modifier NULL also works: tal:attribute=href php:item['route'] ? ro.gen(item['route']) : NULL -- 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
AW: [PHPTAL] Logical operators in PHPTAL
I would love to see this feature, too! Was it no positive feedback or no feedback at all? Do you think it is hard to implement? Does it break backwards compatibility? I would be willing to help with the implementation... Per Von: phptal-boun...@lists.motion-twin.com [mailto:phptal-boun...@lists.motion-twin.com] Im Auftrag von romtek Gesendet: Donnerstag, 30. September 2010 07:45 An: Template Attribute Language for PHP Betreff: Re: [PHPTAL] Logical operators in PHPTAL 2010/9/29 Kornel Lesiński kor...@aardvarkmedia.co.uk On 29 Sep 2010, at 06:33, romtek wrote: I'd like to be able to use a bit more simple logic in my templates. Being able to use AND, OR, and NOT would be good. E.g. tal:condition=event/featured AND event/upcoming, tal:condition=NOT event/featured AND event/upcoming I remember there was an activity to extend the library to make PHPTAL more expressive. What's happened to that? I've asked about this on the mailinglist and didn't get positive feedback, so the feature got shelved. I remember that it was received sufficiently well. If you have some time and desire to implement these features, then I think you should, Kornel. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Why PHPTAL stop rendering doctype after clone.
So when using HTML5 mode in PHPTAL I need to wrap all values in quotes but in output I get them without quotes. Isn't it additional work for parser to remove quotes even when they are permitted in HTML5? PHPTAL has HTML5 *output* mode. Input is always XML (I haven't gotten around to writing HTML5 parser yet). PHPTAL doesn't output markup you write. It reads markup into abstract tree (DOM) and then from that syntax-less tree generates PHP code that generates new markup. Input is completely separated from output. This is similar to the way browsers process markup (e.g., code in innerHTML doesn't retain any syntactical details from your page source). In current implementation decision to generate quotes is taken at compile time, so there's absolutely no penalty at run time. It might even be microscopically faster, as template code ends up few bytes shorter :) -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: AW: [PHPTAL] Logical operators in PHPTAL
On 30-09-2010 at 15:45:46 Per Bernhardt p...@webfactory.de wrote: I would love to see this feature, too! Was it no positive feedback or no feedback at all? http://lists.motion-twin.com/pipermail/phptal/2009-November/001967.html Do you think it is hard to implement? It requires writing a mini compiler with parser that supports operator priorities. Maybe a bit more complex parser if it were to support php: modifier well. I've got basic parser already. Does it break backwards compatibility? It would break compatibility with TALES paths that use spaces, but I presume those are very rare, and could be worked around by using /foo/${string: part with spaces }/bar. I would be willing to help with the implementation... Great! I think the next step would be to work out syntax exactly: http://phptal.org/wiki/doku.php/improvedtales -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Why PHPTAL stop rendering doctype after clone.
Ok thank you for reply. I have just one more question. In which revision is that diry quick fix that you wrote earlier to make PHPTAL write doctype after clone? I just added this to svn:externals in place of 1.2.1: phptal -r 939 https://svn.motion-twin.com/phptal/trunk/classes/ to svn externals But problem is still there. Can you tell me where and what to add to fix this bug ? ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Why PHPTAL stop rendering doctype after clone.
On 30 Sep 2010, at 18:28, Piotr Kroczyński wrote: Ok thank you for reply. I have just one more question. In which revision is that diry quick fix that you wrote earlier to make PHPTAL write doctype after clone? I just added this to svn:externals in place of 1.2.1: r993 phptal -r 939 https://svn.motion-twin.com/phptal/trunk/classes/ to svn externals Wrong revision number. But problem is still there. Can you tell me where and what to add to fix this bug ? The fix is in PHPTAL_Context::setDocType(). Sets it in current context, rather than topmost context. I'm not sure if that is sufficient in all cases, but passes test case you've sent me (which I've added to tests in r991). -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Why PHPTAL stop rendering doctype after clone.
W dniu 30.09.2010 19:37, Kornel Lesiński pisze: On 30 Sep 2010, at 18:28, Piotr Kroczyński wrote: Ok thank you for reply. I have just one more question. In which revision is that diry quick fix that you wrote earlier to make PHPTAL write doctype after clone? I just added this to svn:externals in place of 1.2.1: r993 phptal -r 939 https://svn.motion-twin.com/phptal/trunk/classes/ to svn externals Wrong revision number. But problem is still there. Can you tell me where and what to add to fix this bug ? The fix is in PHPTAL_Context::setDocType(). Sets it in current context, rather than topmost context. I'm not sure if that is sufficient in all cases, but passes test case you've sent me (which I've added to tests in r991). Sorry, I had good revision number but made mistake typing it in email :). Error remain, but maby it is somehow Zend Framework fault. I'm using Zend_View_Helper_Action to make something like widgets on my webpage: /// div id=menu span tal:replace=structure php:actionHelper.action('widget-menu', 'page', 'page') / /div div id=login-form span tal:replace=structure php:actionHelper.action('widget-login-form', 'auth', 'user') / /div div metal:define-slot=content !-- page content here -- /div div id=right-col span tal:replace=structure php:actionHelper.action('widget-letest-news', 'news', 'news') / /div This helper clones controller object (all properties are cloned also so view is cloned too), then execute method and returns generated content (using output buffering I suppose). I use PHPTAL to generate html in those actions. Maby somewhere there is problem. Templates that actions use are quite simple. There is no doctype, html, body etc. Just something like that: // div tal:conditon=news ul tal:repeat=n news li./li /ul /div /// I'll try try understand and modify PHPTAL to get it working. Maby I'll suceed, then I'll write how I did it :). If not then I'll wait for you to do it :) Thank you for help :) Cheers. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal