[PHPTAL] Localization confusion

2012-10-14 Thread Tjerk Meesters
Hi, While putting my localization strings in place I discovered an interesting quirk that perhaps someone could explain. This is my construct: foo bar The idea is that a page can override the default page title by setting the title variable. If not specified, the page title should be translated

Re: [PHPTAL] Escaping ${} and $

2011-09-02 Thread Tjerk Meesters
Hi, Small typo, should be 'escape' instead of 'exscape' ;) On Sep 3, 2011 3:06 AM, "Kornel Lesiński" wrote: > On Fri, 02 Sep 2011 09:59:51 +0100, Tarjei Huse > wrote: > Hi, I'm trying to include a JQuery template containing ${} into a PHPTal template. Is there a way to say "do not use

[PHPTAL] tales eq: modifier

2011-08-26 Thread Tjerk Meesters
Hi guys, Wrote this modifier to solve a small inconvenience with conditional blocks; this time I had five different blocks and I didn't feel like passing five variables to control them. Hope it's useful to you guys ;-) The syntax: "eq:" [ " " expr ]* These are some examples: eq: data/value str

Re: [PHPTAL] [PATCH] Shouldn't skip over __get() just because __isset() was defined…

2011-06-28 Thread Tjerk Meesters
On Tue, Jun 28, 2011 at 2:52 PM, Ivo Võsa wrote: > Kornel Lesiński wrote: >> >> I think it's illogical or buggy. You're saying it's not set, but then you >> expect it to be set anyway. >> >> >> If you have lazily-loaded properties, then you should simply return *true* >> from __isset() for such pr

Re: [PHPTAL] [PATCH] Shouldn't skip over __get() just because __isset() was defined…

2011-06-26 Thread Tjerk Meesters
On Mon, Jun 27, 2011 at 6:36 AM, Terin Stock wrote: > I've been working with PHPTAL for quite some time, and have always been > annoyed that from within the template an object's __get method was being > ignored. I think I've tracked down the bug (in version 1.2.2, though it > still present in trun

Re: [PHPTAL] Extending namespace

2011-06-09 Thread Tjerk Meesters
Why not just have tal:content="nl2br: var" Just define phptal_tales_nl2br() and voila :) On Jun 10, 2011 12:03 PM, "Hisateru Tanaka" wrote: > Hi, > > I'm trying to extend namespace of PHPTAL to use in my framework. > 3 new attributes would introduced. > > pal:content-nl2br > pal:replace-nl2br > p

Re: [PHPTAL] Compiled code sending SPAM?!?

2011-05-14 Thread Tjerk Meesters
Hi, Try to move the cache folder instead, file uploads in /tmp with .php extension could be associated with security breaches in forum/wp sites. On May 15, 2011 8:41 AM, "Marco Afonso" wrote: > Hi all, > > I'm new to PHPTAL and I'm loving it! > > Although, at the same time I started using it on

Re: [PHPTAL] tal:equal ?!

2011-04-13 Thread Tjerk Meesters
For the and operation I've written a modifier that turns all its arguments into an array of booleans and then uses array_mult() to determine the outcome for tal:condition. array_sum could be used for the or-operation ;) On Apr 14, 2011 2:27 AM, "Kornel Lesiński" wrote: > On Wed, 13 Apr 2011 14:45

Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1

2011-01-13 Thread Tjerk Meesters
On Jan 14, 2011 1:17 AM, "Kornel Lesiński" wrote: > > On Thu, 13 Jan 2011 10:22:52 -, Tjerk Meesters < tjerk.meest...@gmail.com> wrote: > >> Here's the problem; it throw an error, saying that the myns namespace >> is not defined ... is that expected?

Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1

2011-01-13 Thread Tjerk Meesters
Hi, Just bumped into something similar. I'm using a so-called skeleton.html (a big macro starting with and defining multiple slots for scripts, styles, content, popups, etc.). Let's say that I define xmlns:myns="http://example.org/myns"; in the of my skeleton.html and then one of my slots gets

Re: [PHPTAL] Re: Feature request: Allow array as parameter of PHPTAL's set() method

2010-11-22 Thread Tjerk Meesters
Hi, My bad, I did read from the beginning but I think certain parts ended in a void ;) Still, in my opinion any function that takes name/value pairs is a candidate for array overloading. I sometimes wished php would do java'ish method overloading ... is there another reason beyond the one-up comp

Re: [PHPTAL] Re: Feature request: Allow array as parameter of PHPTAL's set() method

2010-11-22 Thread Tjerk Meesters
Alternatively you could allow overloading set() to accept an array as its only argument. On Nov 22, 2010 8:40 PM, "Anton Andriyevskyy" wrote: > Separate method is good idea, but the name *setAll *may be confusing, > you may think that it will replace the ones that you have set earlier with > set()

Re: AW: [PHPTAL] Minor feature request

2010-11-04 Thread Tjerk Meesters
Interestingly, that's what I ran into yesterday. Found out that while one version of phptal hides any content inside the empty condition, another (probably older) version would instead show it, causing a rather embarrassing few minutes ;) On Nov 4, 2010 4:49 PM, "Per Bernhardt" wrote: > Hey, use >

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Tjerk Meesters
2010/6/2 Kornel Lesiński : > On 02-06-2010 at 11:10:43 Robert Goldsmith wrote: > >>> Why would someone choose to replace PHPTAL's autoload with something >>> else? (I'm not implying it's perfect or such, just wondering what problem >>> would such option solve). >> >> If people already have autoloa

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Tjerk Meesters
Hi, Zend uses spl_autoload_register() as well I believe, so that should be safe. The main problem I can see is that if there's an existing __autoload() function, spl_autoload_register() will replace it (as stated in the manual). I don't think putting the autoloader in a separate file will make a

Re: [PHPTAL] require_once vs autoloading

2010-06-01 Thread Tjerk Meesters
I could be wrong here, but I think it's not so much any problem with require_once as it is to reduce memory consumption while using the library. This happens when developers only use 30% of the library and yet the whole shebang is loaded on every request ;-) On Wed, Jun 2, 2010 at 5:20 AM, romtek

Re: [PHPTAL] tal:attributes question

2010-03-23 Thread Tjerk Meesters
can write a prefilter that does what I > need. > > On Fri, Mar 12, 2010 at 3:42 PM, Tjerk Meesters > wrote: >> >> Maybe not via a string but being able to pass attributes using an array >> with the keys being attribute names would be handy. >> >> >>

Re: [PHPTAL] tal:attributes question

2010-03-12 Thread Tjerk Meesters
Maybe not via a string but being able to pass attributes using an array with the keys being attribute names would be handy. On 13-Mar-2010, at 4:12, Christina Van Dyke wrote: I know you can assign attributes to a tag by doing this: tal:attributes="class string:myclass; id string:myid;">text

Re: [PHPTAL] PHPTAL template for a calendar view?

2010-02-09 Thread Tjerk Meesters
Why not just use a client side calendar, such as those provided with jquery ui? On 09-Feb-2010, at 19:12, Marco Pivetta wrote: Didn't think about week days and weeks, sorry ^_^'' (Yeah, stupid mistake...) 2010/2/9 Kornel Lesinski On 9 Feb 2010, at 11:00, Marco Pivetta wrote: > Isn't i

Re: [PHPTAL] PHP newline consumption

2009-12-09 Thread Tjerk Meesters
Just out of curiosity, why does this bother you? In (x)html newlines are at best considered one white-space. Are you using this inside ? On 12/10/09, Richard Cernava wrote: > >> > >> > A "feature" of PHP's is to consume a newline when it is following >> > it's closing >> > tag (http://bugs.php.

Re: [PHPTAL] Use of ${} vs tal attributes

2009-12-08 Thread Tjerk Meesters
Also, errors will be silently ignored by default if you use ${}. Changing it to tal:content, for instance, without an alternative (using pipe syntax) would throw a template exception if the used expression could not be resolved at runtime. On 12/9/09, Kornel Lesiński wrote: > On 08-12-2009 at 15:

Re: [PHPTAL] i18n:translate and dynamic tal:content

2009-11-23 Thread Tjerk Meesters
Hi, What do you mean by all-whitespace translation keys? I hope that doesn't mean i18n:translate="" will stop working, because we rely heavily on this feature ;-) On 11/23/09, Kornel Lesiński wrote: > On 22.11.2009, at 20:16, lo...@nic.fi wrote: > >> I'v got a problem translating text that is pr

Re: [PHPTAL] Advanced TALES

2009-11-18 Thread Tjerk Meesters
While I was looking at the pager example, I couldn't help but think this could be fixed by having a few helper classes for this; helper classes that would make your phptal code cleaner and abstract out certain typical tasks of a pager. The same could be said for the dropdown scenario. All in all,

Re: [PHPTAL] Advanced TALES

2009-11-17 Thread Tjerk Meesters
To maintain proper bc I would suggest another namespace, like ntales (new tales) The problem of modifier scope is difficult, unless you can introduce syntax like this: (php:foo()) + foo/bar Braces around the modifier code would define the scope, but this is still error prone if you decide to hav

Re: [PHPTAL] Escaping of dollar sign ($)

2009-11-04 Thread Tjerk Meesters
Would it be possible to use a preg_replace() with two expressions, one to replace $$ by $ and one to handle \b${?(\w+) 2009/11/4 Kornel Lesiński : > On 03-11-2009 at 17:56:02 Tobias Herp > wrote: > >> Kornel Lesiński wrote: >>> >>> I could change it to: >>> >>> ${x} → value >>> $${x} → ${x} >>>

Re: [PHPTAL] Loading phptal.org fails in IE 6

2009-10-29 Thread Tjerk Meesters
Then don't serve the stylesheet; at least it shouldn't give an ugly js alert, wouldn't you agree? :) Besides, the structure of the pages ain't that complex to begin with; not sure who would ever use "run-in" in the first place ;-) On 10/29/09, Kornel Lesiński wrote: > On 28-10-2009 at 04:27:46 r

Re: [PHPTAL] Escaping of dollar sign ($)

2009-10-27 Thread Tjerk Meesters
I vote for not changing the current behaviour; I agree that if it's documented, it can be a little weird ;-) Personally I would choose to have a money formatter TALES construct, because I hate having to go through my templates again when I start adding another currency for instance. Best, Tjer

Re: [PHPTAL] Conditions inside php:

2009-10-22 Thread Tjerk Meesters
Within php: context you should use "option[0]" instead to get the first element of the option array On 10/22/09, Kornel Lesiński wrote: > On 22-10-2009 at 14:09:42 Michael wrote: > >> One more thing: >> My select statement: >> >> >> ${option/1} >> >> >> >> I have a problem with this statemen

Re: [PHPTAL] globally disable auto escaping

2009-10-12 Thread Tjerk Meesters
One way is to use the "structure" keyword to prevent escaping of your already escaped variables. On 10/13/09, admirau wrote: > How to disable auto escaping for all variables? > (I use third party software, which already escapes all the variables). > > -- > regards > takeshin > > _

Re: [PHPTAL] javascript code messed up

2009-09-02 Thread Tjerk Meesters
Start your script with On 9/2/09, GRolf wrote: > I'm using a to fill my macro template with > javascript code. However, all < are converted to $lt;, which (seems > to) cause an error in a for loop > > for (i=0; i < myarray.lenght; i++) { > ... > } > > is converted to > > for (i=0; i < myarray.

Re: [PHPTAL] extending phptal

2009-08-25 Thread Tjerk Meesters
Hi, This is because php doesn't support __set() in array context, which is what phptal uses to define template variables. It's a bit of a drawback to having to construct a temporary array first every time, but with php5 it doesn't incur much penalty since it uses copy-on-write by default ;-) On

Re: [PHPTAL] How do I access array keys?

2009-06-18 Thread Tjerk Meesters
Hmm we've seen this mistake being made a lot ;-) would it help if this was documented under, like, "things to consider when using php: modifier"? :) On 6/18/09, Kornel Lesiński wrote: > On 18-06-2009 at 15:42:14 Igor Sverkos > wrote: > >> If you don't have an object, just an array - how do I acc

Re: [PHPTAL] Re: selected=

2009-06-16 Thread Tjerk Meesters
Hi, What I meant was: tal:attributes="selected exists: isSelected" Always try to avoid using php: constructs in your templates ;-) Bets, Tjerk 2009/6/16 Kornel Lesiński : > On 16-06-2009 at 16:16:53 Igor Sverkos > wrote: > >> Hi, >> >> Tjerk Meeste

Re: [PHPTAL] Re: selected=

2009-06-15 Thread Tjerk Meesters
Hi, As Kornel mentioned, this is fixed in the repos and it can be made to work for older versions by using "exists: isSelected" instead of "isSelected | nothing" Hope that helps :) On 6/16/09, Igor Sverkos wrote: > Hi, > > Tjerk Meesters wrote: >> Hmm I

Re: [PHPTAL] selected="selected" doesn't work for me

2009-06-14 Thread Tjerk Meesters
Hmm I don't think using "selected" as the value is the solution to the exact problem here, because phptal does understand the so called binary attributes, such as selected and checked. Seems like the '| nothing' is causing the expression to change type and display a 1 instead of being treated in a

Re: [PHPTAL] Cannot access $tpl->vars in PHP

2009-06-12 Thread Tjerk Meesters
When doing translations in phptal you can use any backend to load the translation map (not just gettext) by extending the translationservice class and pass this to setTranslator(); personally I would load single translation files inside the useDomain() method and/or setLanguage() For Javascript I

Re: [PHPTAL] New PHPTAL website!

2009-05-31 Thread Tjerk Meesters
Not sure where you see 16px, the browser default font size is being used afaik. The grey top could be reduced though, as well as the menu bar height; other than that, the reading area is wider which is good and it's overall cleaner I find ;-) On Mon, Jun 1, 2009 at 1:27 PM, aaatoja wrote: > For

Re: [PHPTAL] tal:repeat and php:

2009-05-24 Thread Tjerk Meesters
That's because you're using the php: construct; try tal:condition="php: box['nr'] > 5" Though, usually - wherever I can - i insert the condition inside the list of elements I'm iterating over, so that I don't have to use php: Best, Tjerk On Sun, May 24, 2009 at 6:13 PM, Dominique Sandoz wrot

Re: [PHPTAL] Validation of XHTML - Solution

2009-05-18 Thread Tjerk Meesters
lot" without the tal: prefix 3) same for i guess? ;-) Best, Tjerk On Mon, May 18, 2009 at 3:12 PM, Guillaume Lecanu wrote: > Le dimanche 17 mai 2009 à 20:32 +0800, Tjerk Meesters a écrit : > >> >>> It would be much easier if you could just add tal: and metal: in

Re: [PHPTAL] Validation of XHTML

2009-05-17 Thread Tjerk Meesters
Hi, On Sun, May 17, 2009 at 6:52 PM, wrote: >> Thanks for this information, do you have created a custom DTD for PHPTAL > with all the attributes list ? >> This will be cool if you can share it :-) > > I have sent a copy of the custom DTD privately. It merely appends some > attributes that enabl

Re: [PHPTAL] Validation of XHTML

2009-05-15 Thread Tjerk Meesters
It would be much easier if you could just add tal: and metal: inside the %coreattrs definition ;-) On Sun, Apr 12, 2009 at 11:16 PM, wrote: > To follow up my own posting, I've found it's possible to get the W3C > validator to accept tal: and metal: attributes by using a DOCTYPE that > points to

Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-29 Thread Tjerk Meesters
Guess the __DIR__ constant came a bit too late then ;-) On 4/29/09, Kornel Lesiński wrote: > On 29-04-2009 at 00:53:41 romtek wrote: > >>> OK, I've given up on require() and changed it all to require_once(). >> >> Is there ever a reason to use require() to include code (not text)? > > I hoped it

Re: [PHPTAL] Selected attribute in select list

2009-04-28 Thread Tjerk Meesters
Because "selected" is one of those special attributes in php you can also just use: If I'm not mistaken, a boolean value for "active" should work the way you want it. On 4/28/09, Julian Haupt wrote: > Hi, > >> The way you USA should work, but try this: >> >> >> >> > > In general it mig

Re: [PHPTAL] Selected attribute in select list

2009-04-27 Thread Tjerk Meesters
Within php: context the period "." is expanded to "->" afaik, so if your variable is not an object, try using c['id'] instead of c.id On 4/28/09, Matt Marron wrote: > I have been trying to figure out how to get the selected option to properly > show up in a select list all day with no success. I

Re: [PHPTAL] Template storage in database?

2009-04-22 Thread Tjerk Meesters
Use setSource() of the phptal class to load from a string that you fetch from your db On 4/23/09, Jason La wrote: > Hi, > > Is possible to store templates in a database instead of the file > system, and how would I go about doing that? > > Thanks, > Jason > === > Jason La > jaso...@gm

Re: [PHPTAL] Template folder problem

2009-03-27 Thread Tjerk Meesters
I would solve this problem by making paths to javascript, css and images absolute (i.e. /js/script.js) This avoids any issues with relative paths in html but also in css (referring bg images for instance) On 3/27/09, Daniel Lima wrote: > Hi, > > Yeah, that is ok! But, if my webdesigner uses a w

Re: [PHPTAL] Set option as selected when an array is used

2009-03-19 Thread Tjerk Meesters
Hi, Try item['value'] instead of item.value inside the php: block; the dot is translated as -> which would be incorrect as your value is an array element. On 3/19/09, Daniel Lima wrote: > Hi, > > I have the follow PHP script: > > ... > $datagrid = new Cilens_Grid; > echo $datagrid.*resultsPerPa

Re: [PHPTAL] Dynamic defined slots

2009-02-06 Thread Tjerk Meesters
Wouldn't it make more sense to turn your define-slot's into use-macro instead? ;-) On 2/6/09, kaaposc wrote: > Hello! > > Is there any way to define slots on the fly? Like this: > > > Currently looks like PHPTAL takes slot name as string without trying to > parse. And of course PHP complaints a

Re: [PHPTAL] Macro in macro?

2009-01-30 Thread Tjerk Meesters
For this to work, in your forum template, you have to wrap define-macro=forum around the use-macro=main On 1/31/09, Szymek Przybył wrote: > I have website which uses phptal, it is main tempate: > > > > > ... > > ... > > > And it is some page template: > > > > This is an expamle > >

[PHPTAL] phptal and reflection

2008-03-10 Thread Tjerk Meesters
Hi, After my recent recompilation of PHP, the logs were showing errors regarding the reflection classes; however, the documentation never states its dependency. Tip: make sure that the ./configure line doesn't include "--disable-reflection" during PHP installation. Best, Jack

Re: [PHPTAL] PHPTAL_RepeatController and PDOStatement

2008-02-02 Thread Tjerk Meesters
Alternatively, the correct controller could be chosen based on the intended usage. If a repeat block doesn't use the value of "last" this doesn't even apply. If "last" is being used, pre-fetching may be an option to get the intended value of count() Actually this could apply to other functions as