[PHPTAL] Chained expressions on tal:condition

2008-01-31 Thread Iván -DrSlump- Montes
Hello list, I've modified the tal:condition attribute to handle chained expressions so it can do stuff like cart/items | nothing or even showItems | cart/items | nothing. I'm attaching the whole modified file since the almost all lines have changed. I've also noticed that phptal_isempty()

Re: [PHPTAL] PHPTAL_RepeatController and PDOStatement

2008-02-03 Thread Iván -DrSlump- Montes
Following with the repeat discussion I've refactored the repeat controller to add some Zope features missing from it. I've also added support for PHP internal objects implementing Traversable (like PDO) by traversing the object at instantiation time and storing all the results in a temporary

Re: [PHPTAL] Table column with difference value

2008-03-23 Thread Iván -DrSlump- Montes
I haven't tried it but perhaps something like this can give you the result: tr tal:repeat=item data td tal:content=item/totalTotal/td td tal:content=php: lastTotalLast Total/td ?php $ctx-lastTotal = $ctx-item['total']; ? /tr or tr tal:repeat=item data td tal:content=item/totalTotal/td

Re: [PHPTAL] php: modifier and path: arguments

2008-04-14 Thread Iván -DrSlump- Montes
I think to recall that variables in the php: modifier must be written without the $ prefix, so your code should be something like this: b tal:content=php: strtoupper( configItem.name ) Iván On Mon, Apr 14, 2008 at 11:43 AM, B. Kamer [EMAIL PROTECTED] wrote: hi i am wondering how to do the


2008-04-23 Thread Iván -DrSlump- Montes
I don't know of any publicly available DTDs for TAL. So either you find a validation tool which doesn't try to load external/unknown DTDs or you create the DTDs yourself and host them somewhere. PS: You can also create some sample data and generate the tal page with it before handling it to the

Re: [PHPTAL] i18n:translate on an attribute ?

2008-04-26 Thread Iván -DrSlump- Montes
Does something like the following work? tal:block tal:define=global submitMsg div i18n:translate=submit / /tal:block input type=submit name=submit tal:attributes=value submitMsg / Iván On Sat, Apr 26, 2008 at 5:58 PM, Guillaume Lecanu [EMAIL PROTECTED] wrote: Hi, Is it possible to

Re: [PHPTAL] Re: developer of PHPTAL or not

2008-05-30 Thread Iván -DrSlump- Montes
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

Re: [PHPTAL] Tal conditions

2008-06-19 Thread Iván -DrSlump- Montes
I think that the correct syntax for that is: tal:condition=php: profile.profile_id GT 0 You need to use the 'php' tales modifier to evaluate an expression, otherwise it's evaluated as a path. Iván On Fri, Jun 20, 2008 at 12:35 AM, Reza Sanaie [EMAIL PROTECTED] wrote: Hi all, Why would the

Re: [PHPTAL] Avoid intermediate phptal files

2008-07-31 Thread Iván -DrSlump- Montes
Kornel, It might be a good idea to create a small section in the manual for sysadmins. Explaining why compiled templates are created, ideal permission sets, how to change the default location ... Ivan On Thu, Jul 31, 2008 at 4:04 PM, Alejandro Giardino [EMAIL PROTECTED] wrote: Hello Kornel

Re: [PHPTAL] Avoid intermediate phptal files

2008-07-31 Thread Iván -DrSlump- Montes
On Thu, Jul 31, 2008 at 6:00 PM, Kornel Lesiński [EMAIL PROTECTED] wrote: It's a good idea. Can you do it? :) Please feel free to modify it as you see fit. PHPTAL for SysAdmins: PHPTAL functions by generating PHP files from the template's logic, this means that it needs a directory to store

Re: [PHPTAL] Best way to make a list of list

2008-08-08 Thread Iván -DrSlump- Montes
I think the only way to do nested structures with PHPTAL is using Metal's macros. Have you looked at it? Iván On Fri, Aug 8, 2008 at 6:18 PM, Guillaume Lecanu [EMAIL PROTECTED] wrote: Hello, I need to make a menu, with some sub-menus and other sub-menus etc. For example : * Menu A : *

Re: [PHPTAL] php if else syntax in phptal

2008-10-12 Thread Iván -DrSlump- Montes
Edu, The problem is probably that PHPTAL parser doesn't know how to correctly process the PHP ternary operator. I suggest you try using a function to accomplish the same: function ternary($condition, $true, $false) { return $condition ? $true : $false; } table tal:attributes=class php:

Re: [PHPTAL] How to disable autoquote ?

2008-10-13 Thread Iván -DrSlump- Montes
prefix the content with the 'structure' keyword, it will use the value verbatin. script tal:content=structure myJsCode/script ciao, /imv On Mon, Oct 13, 2008 at 10:13 PM, Guillaume Lecanu [EMAIL PROTECTED] wrote: Hi, I want to write a dynamic JS content into the script/scriptbalise. A

Re: [PHPTAL] How to disable autoquote ?

2008-10-14 Thread Iván -DrSlump- Montes
I think that CDATA is special enough as to have its own handler, I mean that it should be equivalent to 'structure'. Since TAL should output XML valid documents, having a way to specify a CDATA section seems logical. ie: script tal:content=cdata myJsCode/script pre tal:content=cdata

Re: [PHPTAL] Need some help with a loop

2008-11-22 Thread Iván -DrSlump- Montes
Hi, This is one of the cases where TAL is a bit strange to work with. The following should work even if the HTML generated is not standards compliant. tal:block repeat=image images tal:block tal:replace=structure 'lt;trgt;' tal:condition=php:repeat.image.index % 5 == 0 / td img

Re: [PHPTAL] Best practices for performance?

2009-01-04 Thread Iván -DrSlump- Montes
Hi Alister, PHPTAL compiles its templates into native PHP code so the runtime overhead is very low. I don't know much about WP's native templating engine but I think to recall it was just some hooks (php functions) being called by the core. In this case PHPTAL would be a tad slower but not enough

Re: [PHPTAL] Security issues with a CMS

2009-01-09 Thread Iván -DrSlump- Montes
On Fri, Jan 9, 2009 at 11:35 AM, Kornel Lesiński kor...@aardvarkmedia.co.uk wrote: I disagree. There's nothing wrong with allowing someone to write comment like scriptalert('xss')/script. I just did that! I hope your e-mail client didn't execute the code, and didn't remove it either. That's

Re: [PHPTAL] Inject PHP Code into template?

2009-02-02 Thread Iván -DrSlump- Montes
The PHPTAL way would be to create a custom tales modifier [1], although what admirau proposes will also work. [1] http://phptal.motion-twin.com/manual/en/split/ar06s08.html ciao, /imv On Mon, Feb 2, 2009 at 6:45 PM, admirau admi...@gmail.com wrote: W dniu 2009-02-02 18:31, Christian Welzel

Re: [PHPTAL] Re: Security bug in PHPTAL?

2009-02-12 Thread Iván -DrSlump- Montes
It sure looks like there is a security hole in those servers, perhaps it's a bug on some web software running in them (Wordpress, Joomla, phpMyAdmin...) which allows the attacker to modify files writable by the web server. Review the last modified date of the affected files and then search for

Re: [PHPTAL] Re: Dynamic allocation of objects inside PHPTAL templates

2009-02-17 Thread Iván -DrSlump- Montes
I would think so. You can however work around it by using a factory pattern, that is, a function wich returns an instance of the object. ie: function GuestListFactory( $param1, $param2 ){ return new GuestList( $param1, $param2 ); } regards, Ivan On Tue, Feb 17, 2009 at 10:35 AM, romtek

Re: [PHPTAL] Need confirmation about the pipe syntax inside tal:attributes

2009-08-07 Thread Iván -DrSlump- Montes
That's an invalid tales syntax. The correct expression following the ZPT specs should be: tal:attributes=value firstname | nothing Where nothing is evaluated as a tales keyword which returns an empty string. I haven't used PHPTAL in a while and I can't remember if the nothing keyword was

Re: [PHPTAL] What is the better way for Radio Button default value ?

2009-08-07 Thread Iván -DrSlump- Montes
I guess something like this should work. input type=radio tal:attributes=checked php:P.civility eq 'Miss' value=Miss ... / input type=radio tal:attributes=checked php:P.civility eq 'Ms' value=Ms ... / input type=radio tal:attributes=checked php:P.civility eq 'Mr' value=Mr ... / This is one of

Re: [PHPTAL] Re: disabling PHPTal parsing for blocks

2009-08-07 Thread Iván -DrSlump- Montes
As a work around perhaps you can place the Javascript template code in separate files and use them like this: script ?php include('my_javascript_tal_template.jstal'); ? /script regards, /imv On Fri, Aug 7, 2009 at 4:28 PM, Richard Cernava cern...@gmail.com wrote: Kornel Lesiński kor...@...

Re: [PHPTAL] Fwd: stripping or escaping php code in templates

2009-08-09 Thread Iván -DrSlump- Montes
Have a look at PHP's tokenizer function token_get_all. It will give you a rock solid base for your filter since it uses the same parser used in the PHP engine. regards, /imv On Sun, Aug 9, 2009 at 8:40 PM, Ionut Matei johnu...@gmail.com wrote: Thank you all for your input. I want only to

Re: [PHPTAL] PHPTAL prefilters

2009-09-16 Thread Iván -DrSlump- Montes
On Wed, Sep 16, 2009 at 12:23 PM, Iván -DrSlump- Montes drsl...@pollinimini.net wrote: Using only the autoloader/include_path might be a little limiting in my opinion. It would make it harder to replace a standard filter class for example. Besides, implementing a simplified plugin loader wouldn't

[PHPTAL] Incompatibility between PHPTAL exceptions and xdebug

2009-10-05 Thread Iván -DrSlump- Montes
Hi, When throwing a PHPTAL_TemplateException (or a descendant of it) exception in an environment with the Xdebug extension activated, it results in a fatal error, triggered by Xdebug, since it checks the types of the message, file and line properties (string, string and integer respectively).