Re: [PHPTAL] automated documentation for templates?
On Thu, 29 May 2008 20:25:51 +0100, Jason - USL [EMAIL PROTECTED] wrote: For example, if my template designer creates something like tal:repeat=option options, my php developer would see a corresponding line in the documentation saying that the variable 'options' needs to be set, and it needs to implement the iterable interface... This could be useful indeed. But you don't need to change PHPTAL itself - templates are supposed to be XML after all. You could try to implement this with XSLT or XPath + PHP. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Lower than as char in javascript
Le jeudi 29 mai 2008 à 22:55 +0200, Christian Welzel a écrit : Hi there, is there a way to insert a lower than in phptal, which is printed as lower than in the source code? My problem: i have a javascript part in my template where i need a lower than in some cases ... ( if(foo 0) { do(); } ) I could not find a simple way to add this to the code. The only way i found is this: if( foo span tal:replace=structure lessthen / 0) { do(); } and define lessthan = '' in my phpcode. Hi, Is your JavaScript is between a CDATA block ? script type=text/javascript // ![CDATA[ (your JavaScript here) // ]] /script And it's also a good idea to put JS code in an external file like that : script type=text/javascript src=code.js/script ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] automated documentation for templates?
Le jeudi 29 mai 2008 à 22:14 +0200, Iván -DrSlump- Montes a écrit : NaturalDocs [1] is a very flexible documentation system which can be configured to suit almost any language [2]. The documentation could look something like this: !-- Iterable: options Members: label - The option label selected - Is the option selected? value - The option value -- div tal:repeat=option options /div [1] http://www.naturaldocs.org [2] http://www.naturaldocs.org/customizinglanguages.html The idea of Jason is very good. Iván, NaturalDocs could be an idea, but only if PHPTAL can remove theses HTML comments. This could be problematics if theses comments are show in the final HTML source. On Thu, May 29, 2008 at 9:54 PM, Anton Andrievskij [EMAIL PROTECTED] wrote: Hi, Jason. I think your idea is useful and we it need be realized. What other people think? Anton On Thu, May 29, 2008 at 10:25 PM, Jason - USL [EMAIL PROTECTED] wrote: Hi, everybody. I'm wondering if anybody's created or thought about a system for documenting the PHPTAL templates themselves. It seems to me that, for a project of any size, it would be ideal if each template could be processed by a documentation engine that tells the developers which variables/objects/arrays need to be passed into the template and how they're used. For example, if my template designer creates something like tal:repeat=option options, my php developer would see a corresponding line in the documentation saying that the variable 'options' needs to be set, and it needs to implement the iterable interface... I though maybe it could be achieved by hacking together some custom objects to use in place of the standard PHPTAL_Php_CodeGenerator and PHPTAL_Php_CodeWriter to generate documentation instead of compiled template files. After getting into the code, though, it looks like a bigger project than I'd thought. So, I was wondering if anybody on the list has done something like this, or has better ideas for communicating and documenting the templates' functions. Thanks for any advice you can give, Jason ___ 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
Re: [PHPTAL] problem with proteced function
On Fri, 30 May 2008 13:20:38 +0100, anru chen [EMAIL PROTECTED] wrote: zend framework has a Zend_Config class, in that class, __isset is a protected function. so if i am pass a Zend_Config object to PHPTal, and try to do some thing like a href=www.foo.com tal:attributes=href config/webhost here/a PHP throws this error: Fatal error: Call to protected method Zend_Config::__isset() from context '' in e:\php\PEAR\PHPTAL\Context.php on line 269. I've replaced method_exists with is_callable and this should solve the problem. Please try the SVN version: svn co https://svn.motion-twin.com/phptal/trunk/classes phptal -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Re: PHPTAL Digest, Vol 39, Issue 13
Patrick, are you developer of PHPTAL or not? Anton On Fri, May 30, 2008 at 5:29 PM, Patrick Burke [EMAIL PROTECTED] wrote: I love PHPTAL, and the self documentation thread going on is a very interesting idea. The requirement that brought up self-documentation seems like a development environment issue though, The development environment issue seems odd to me because I would think that the core variables needed would be made available by Development. If Design needs some variables that Devel needs to know about then a simple intermediate layer would let Design do their own $template_obj-set('thevar', thevalue); But if the code is nicely segmented then some designated member of Design should be able to add to the PHP code that is loading the template directly (ideally, anyone on Design if the code is locked down and versioned). I'm not poo-poo'ing the self-documentation idea, I'm just sick of Smarty and I know PHPTAL can become the de facto PHP standard if development of PHPTAL, in the short term, were geared more towards marketing bullet points that can be proudly displayed on a big, pretty banner on a web page. So I'd like to see some awesome effort (yes, I'm talking to myself as well) towards things like memcached integration, Eclipse/editor plugins, get rally slick with the trigger and format systems, and even a geeky effort to do an extended promotional push (yes, I'm mentioning a project that doesn't necessarily involve coding) because, admit it, PHPTAL was there at 1.18 so it's ready to get a little promotion and that means people coordinating a push. I'm seeing PHPTAL at a tipping point. I wasn't able to get PHPTAL into many environments in the last couple years because big, fat, ugly Smarty was sitting in the templates directories already. PHPTAL has awesome core features, is better than fast enough, and has a great lookin' future so it's not hard to pitch it when I can get a chance to list off the coolness of it. I, and others, will get more of a chance to pitch it if there were just a few more..I hate to say this but..enterprise features that make it more known about to higher level Development leads. It's true though. Hew On Fri, May 30, 2008 at 6:00 AM, [EMAIL PROTECTED] wrote: Send PHPTAL mailing list submissions to phptal@lists.motion-twin.com To subscribe or unsubscribe via the World Wide Web, visit http://lists.motion-twin.com/mailman/listinfo/phptal or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of PHPTAL digest... Today's Topics: 1. Re: automated documentation for templates? (Kornel Lesinski) -- Message: 1 Date: Fri, 30 May 2008 10:32:04 +0100 From: Kornel Lesinski [EMAIL PROTECTED] Subject: Re: [PHPTAL] automated documentation for templates? To: Template Attribute Language for PHP phptal@lists.motion-twin.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 On Fri, 30 May 2008 10:19:18 +0100, Iván -DrSlump- Montes [EMAIL PROTECTED] wrote: With something like this the comment won't show up tal:comment tal:replace=null!-- Comment: Here is a comment which won't show up in the generated HTML --/tal:comment any element can have tal:comment attribute. li tal:comment=won't be in HTML / and it's possible to register your own attribute or namespace in PHPTAL, so you could have li my:documentation=... / -- regards, Kornel -- ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal End of PHPTAL Digest, Vol 39, Issue 13 ** ___ 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] Multiple conditions
Hi, guys. How can I specify multiple conditions using AND logical operator and php: for one of the parts? I'm trying this but does not works: tal:condition=exists: products AND php:count(products) == 0 Thanks, Anton ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Re: developer of PHPTAL or not
I agree about 'marketing friendly' too. PHPTAL guys, lets improve on this part. I'll help doing my best for this task. Anton On Fri, May 30, 2008 at 7:28 PM, Iván -DrSlump- Montes [EMAIL PROTECTED] wrote: I've been trying to push for PHPTAL use in several projects in the last years but I haven't been very successful. I ended up writing my own version from scratch a couple of months ago, leveraging new PHP 5.3 features and the bundled XML parsers + Tidy for legacy templates. The main point in implementing my own version was to make it extremely modular to support custom storage (file, string, pdo...), easily extendable namespaces, tales modifiers, pre/post filters and code generation in other languages besides PHP (Javascript). While PHPTAL supports most of that stuff it's showing its age and doesn't makes use of modern PHP's OO features. That's why I target 5.3, so I can tell management that the library is using 'latests technology' and is easily hookable into existing frameworks like ZF or Symfony. Using a BSD like license was also required in some projects. As for integration with IDEs, being an XML format I guess the only thing needed is to implement a DTD and a RelaxNG schema to cover most editors. I also agree on that it needs to be more 'marketting friendly', the home page is an invaluable resource given that the manual is quite complete but it does not sale the product. And a section with tips and tricks (zebra rows, working with javascript, ...) would also help a lot newcomers. Iván On Fri, May 30, 2008 at 5:33 PM, Patrick Burke [EMAIL PROTECTED] wrote: Anton, yes I am a developer of PHPTAL but I'm not on the PHTPAL developer list. My modifications have been specific to the company I was implementing it for but I've made more general modifications along the way, like some memcached/compiled templates trickery I used at the last place I did a gig for, and I'm ready to make a formal contribution so the PHPTAL Developers can tell me what's up/what they think. But even if my own contributions get shot down I'd like to see development of PHPTAL geared towards the people I have to pitch to: CTOs, IT Managers, Directors/Producers of Internet Programming, etc. Just for a while anyways, just until there's undeniable awareness of PHPTAL in that segment of IT personnel. I think it's only a matter of adding and promoting a few more enterprise features to the project (I really, rally hate that enterprise term but...you probably know what I mean when I say it so that's why I'm using it). I've probably got another couple of months before I get up to speed on the latest version of PHPTAL and then implement the memcached thingy I did. Hopefully I'm an official PHPTAL developer at that point. But do you get what I'm saying about the direction of development in the short term? It's just that I know too many CTO types that have actually heard of Smarty but are baffled by this new-fangled PHPTAL stuff, and they aren't even keen on hearing about it until I start sneaking in comments like, See, that problem just simply doesn't ever happen when you use PHPTAL, or We wouldn't worry about that bottleneck if we had something like PHPTAL's system. Know what I mean? Hew ___ 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] Re: PHPTAL Digest, Vol 39, Issue 13
On Fri, 30 May 2008 15:29:10 +0100, Patrick Burke [EMAIL PROTECTED] wrote: I'm seeing PHPTAL at a tipping point. I wasn't able to get PHPTAL into many environments in the last couple years because big, fat, ugly Smarty was sitting in the templates directories already. Perhaps writing Smarty → PHPTAL converter would help here? (this is challenging project as it requires figuring out what all kinds of crazy smarty-html mixes are supposed to do, e.g. {if}s around attributes). -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Multiple conditions
PHPTAL rewrites code in php: expressions to use TAL variables, so it will work fine. Please can you explain a bit more about this? How it works? On Fri, May 30, 2008 at 7:47 PM, Kornel Lesinski [EMAIL PROTECTED] wrote: On Fri, 30 May 2008 17:36:34 +0100, Anton Andrievskij [EMAIL PROTECTED] wrote: 1. But then php will check if real products variable exists but not tal-object's product property? PHPTAL rewrites code in php: expressions to use TAL variables, so it will work fine. php:isset(var) is equivalent to exists:var (but not in more complex case of exists:var/prop - then you're out of luck ;) 2. Why it is bad idea to have some logical operands in PHPTAL then? It isn't. It's a bit of syntax that's missing from plain TAL. -- 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] Re: PHPTAL Digest, Vol 39, Issue 13
I think it is better to get new developers with new programming logic to use PHPTAL. Then you will have more strong and professional community. Smarty must go to the syncope together with its old-type programmers. As for me - I never used Smarty because I found it ugly and stupid the first time I opened their features list. Anton On Fri, May 30, 2008 at 7:54 PM, Kornel Lesinski [EMAIL PROTECTED] wrote: On Fri, 30 May 2008 15:29:10 +0100, Patrick Burke [EMAIL PROTECTED] wrote: I'm seeing PHPTAL at a tipping point. I wasn't able to get PHPTAL into many environments in the last couple years because big, fat, ugly Smarty was sitting in the templates directories already. Perhaps writing Smarty → PHPTAL converter would help here? (this is challenging project as it requires figuring out what all kinds of crazy smarty-html mixes are supposed to do, e.g. {if}s around attributes). -- 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] Re: developer of PHPTAL or not
On Fri, 30 May 2008 17:28:18 +0100, Iván -DrSlump- Montes [EMAIL PROTECTED] wrote: I've been trying to push for PHPTAL use in several projects in the last years but I haven't been very successful. I ended up writing my own version from scratch a couple of months ago, leveraging new PHP 5.3 features and the bundled XML parsers + Tidy for legacy templates. The main point in implementing my own version was to make it extremely modular to support custom storage (file, string, pdo...), easily extendable namespaces, tales modifiers, pre/post filters and code generation in other languages besides PHP (Javascript). While PHPTAL supports most of that stuff it's showing its age and doesn't makes use of modern PHP's OO features. That's why I target 5.3, so I can tell management that the library is using 'latests technology' and is easily hookable into existing frameworks like ZF or Symfony. Using a BSD like license was also required in some projects. Is this something you could share? I have nothing against making PHPTAL more modern and modular :) -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Multiple conditions
On Fri, 30 May 2008 17:59:58 +0100, Anton Andrievskij [EMAIL PROTECTED] wrote: PHPTAL rewrites code in php: expressions to use TAL variables, so it will work fine. Please can you explain a bit more about this? How it works? There's a simple PHP parser that modifies the code (see Php/Transformer.php). Mostly variables get prefixed with $ctx-, so isset(var) becomes isset($ctx-var). -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Re: developer of PHPTAL or not
Sure I don't mind to share, it's just that I've been way to busy with other projects and in its current state is not usable. I was in the middle of a huge refactoring when I stopped working on it. The repository is at: http://svn.pollinimini.net/drtal/trunk And generated documentation at: http://svn.pollinimini.net/drtal/trunk/docs/DrTal-php.html Things I have planned to add is the use of the SPL where it makes sense (ArrayObject, Iterators), PHP 5.3 namespaces and code generator to compile templates into javascript code. Iván On Fri, May 30, 2008 at 7:07 PM, Kornel Lesinski [EMAIL PROTECTED] wrote: On Fri, 30 May 2008 17:28:18 +0100, Iván -DrSlump- Montes [EMAIL PROTECTED] wrote: I've been trying to push for PHPTAL use in several projects in the last years but I haven't been very successful. I ended up writing my own version from scratch a couple of months ago, leveraging new PHP 5.3 features and the bundled XML parsers + Tidy for legacy templates. The main point in implementing my own version was to make it extremely modular to support custom storage (file, string, pdo...), easily extendable namespaces, tales modifiers, pre/post filters and code generation in other languages besides PHP (Javascript). While PHPTAL supports most of that stuff it's showing its age and doesn't makes use of modern PHP's OO features. That's why I target 5.3, so I can tell management that the library is using 'latests technology' and is easily hookable into existing frameworks like ZF or Symfony. Using a BSD like license was also required in some projects. Is this something you could share? I have nothing against making PHPTAL more modern and modular :) -- 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] Multiple conditions
On Fri, May 30, 2008 at 07:04:47PM +0300, Anton Andrievskij wrote: How can I specify multiple conditions using AND logical operator and php: for one of the parts? I'm trying this but does not works: tal:condition=exists: products AND php:count(products) == 0 in python an empty list is also false. iirc phptal works in the same way. so maybe you are better of by setting products all the time - even if the list is empty - and then just tal:condition=products? -- cu pgpyAQYtfKCxW.pgp Description: PGP signature ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal