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 myExampleCode/pre

What I'm not sure of is how would it escape the cdata mark for 'script'
contents. Should it assume // is a common enough to use it as default,
should /* */ be used so it's ok also for CSS?

ciao,
ivan


On Tue, Oct 14, 2008 at 11:28 AM, Kornel Lesiński 
[EMAIL PROTECTED] wrote:

 On 14-10-2008 at 10:08:15 Ernesto Baschny [cron IT] [EMAIL PROTECTED]
 wrote:

  It would be cool to have a tal:cdata= boolean value, where one could
 switch on generation of CDATA wrapping automatically, so one could write:

 script tal:content=structure myJsCode tal:cdata=true/script

 And doesn't have to remember all kinds of required CDATA quoting.


 Something like that would be nice indeed. I think it would be even better
 if PHPTAL could automatically add CDATA to script when it's needed.

 --
 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


[PHPTAL] phptal:debug doesn't works ?

2008-10-14 Thread Guillaume Lecanu
Hi,

When there is an error into my code, the error reported by PHPTAL is not
really precise.
I'm searching a way to tell me which line in my original template file
the error is found.

I have tried to put phptal:debug in some of XHTML tags but I don't see
any differences.

There is a solution for that ?

Thanks again.
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] phptal:debug doesn't works ? [not ok with macros ?]

2008-10-14 Thread Guillaume Lecanu
Le mardi 14 octobre 2008 à 13:55 +0200, Guillaume Lecanu a écrit :

 Le mardi 14 octobre 2008 à 12:32 +0100, Kornel Lesiński a écrit : 
 
  On 14-10-2008 at 12:01:27 Guillaume Lecanu [EMAIL PROTECTED] wrote:
  
   When there is an error into my code, the error reported by PHPTAL is not
   really precise.
   I'm searching a way to tell me which line in my original template file
   the error is found.
  
  What error are you getting?
 
 Oh I have just see the differences ! 
 The line in the template is reported with phptal:debug=, it's
 exactly what I want :-)
 
 Thanks again !


Argh, just tried with macros, and this doesn't report the good line.

Technically, I have a /templates/template.html with some of global parts
common to every page.
Into this template.html, there :
div id=content metal:use-macro=$template_file/content/div

All others html pages have a macro named content, called by the
template.html.

The line error reported by phptal:debug is good if the error is into
template.html
But, if the error is into the macro of another file, this go at the
wrong line of the html file.

There is a trick to have the good line ?


 
 
  
   I have tried to put phptal:debug in some of XHTML tags but I don't see
   any differences.
  
   There is a solution for that ?
  
  Put phptal:debug on html element (or the outermost element in your  
  template).
  
  If you have syntax error in php: expression, then unfortunately PHPTAL  
  won't be able to tell you original line number - you'll have to open file  
  reported by PHP (/tmp/tpl_123...php) and try to make sense of it.
 
 
 
 ___
 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] How to disable autoquote ?

2008-10-14 Thread Kornel Lesiński
On 14-10-2008 at 10:53:58 Iván -DrSlump- Montes [EMAIL PROTECTED]  
wrote:


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 myExampleCode/pre


Trick with CDATA is really needed only in script. It wont't work in most  
elements (including pre) in text/html mode, so I think it's not worth to  
make it a global attribute (when someone uses real XML, they shouldn't be  
micromanaging CDATA).



What I'm not sure of is how would it escape the cdata mark for 'script'
contents. Should it assume // is a common enough to use it as default,
should /* */ be used so it's ok also for CSS?


I'd use /**/ in JS, because it is safer (e.g. won't break if someone has  
postprocessing filter that removes line breaks).


For CSS it isn't needed as much, becase  and  aren't used in CSS  
syntax (except strings in generated content, which are rare).


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] How to disable autoquote ?

2008-10-14 Thread Kornel Lesiński
On 14-10-2008 at 10:08:15 Ernesto Baschny [cron IT] [EMAIL PROTECTED]  
wrote:



It would be cool to have a tal:cdata= boolean value, where one could
switch on generation of CDATA wrapping automatically, so one could write:

script tal:content=structure myJsCode tal:cdata=true/script

And doesn't have to remember all kinds of required CDATA quoting.


Something like that would be nice indeed. I think it would be even better  
if PHPTAL could automatically add CDATA to script when it's needed.


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] How to disable autoquote ?

2008-10-14 Thread Guillaume Lecanu
Le mardi 14 octobre 2008 à 09:55 +0100, Kornel Lesiński a écrit :

 On 13-10-2008 at 21:22:26 Iván -DrSlump- Montes [EMAIL PROTECTED]  
 wrote:
 
  prefix the content with the 'structure' keyword, it will use the value
  verbatin.
 
  script tal:content=structure myJsCode/script
 
 This may make XHTML ill-formed if there's any  or  in the script.
 
 script/*![CDATA[*/
 ${structure myJSCode}
 /*]]*//script
 
 works in both text/html and application/xhtml+xml modes.

Great, thanks Kornel !


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] How to disable autoquote ?

2008-10-14 Thread Kornel Lesiński
On 13-10-2008 at 21:22:26 Iván -DrSlump- Montes [EMAIL PROTECTED]  
wrote:



prefix the content with the 'structure' keyword, it will use the value
verbatin.

script tal:content=structure myJsCode/script


This may make XHTML ill-formed if there's any  or  in the script.

script/*![CDATA[*/
${structure myJSCode}
/*]]*//script

works in both text/html and application/xhtml+xml modes.

--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] How to disable autoquote ?

2008-10-14 Thread Ernesto Baschny [cron IT]
Kornel Lesiński wrote: on 14.10.2008 10:55:
 prefix the content with the 'structure' keyword, it will use the value
 verbatin.

 script tal:content=structure myJsCode/script
 This may make XHTML ill-formed if there's any  or  in the script.

 script/*![CDATA[*/
 ${structure myJSCode}
 /*]]*//script

 works in both text/html and application/xhtml+xml modes.

It would be cool to have a tal:cdata= boolean value, where one could
switch on generation of CDATA wrapping automatically, so one could write:

script tal:content=structure myJsCode tal:cdata=true/script

And doesn't have to remember all kinds of required CDATA quoting.

Cheers,
Ernesto


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] phptal:debug doesn't works ?

2008-10-14 Thread Kornel Lesiński

On 14-10-2008 at 12:01:27 Guillaume Lecanu [EMAIL PROTECTED] wrote:


When there is an error into my code, the error reported by PHPTAL is not
really precise.
I'm searching a way to tell me which line in my original template file
the error is found.


What error are you getting?


I have tried to put phptal:debug in some of XHTML tags but I don't see
any differences.

There is a solution for that ?


Put phptal:debug on html element (or the outermost element in your  
template).


If you have syntax error in php: expression, then unfortunately PHPTAL  
won't be able to tell you original line number - you'll have to open file  
reported by PHP (/tmp/tpl_123...php) and try to make sense of it.


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] phptal:debug doesn't works ? [not ok with macros ?]

2008-10-14 Thread Kornel Lesiński

On 14-10-2008 at 13:01:28 Guillaume Lecanu [EMAIL PROTECTED] wrote:


Argh, just tried with macros, and this doesn't report the good line.

Technically, I have a /templates/template.html with some of global parts
common to every page.
Into this template.html, there :
div id=content metal:use-macro=$template_file/content/div

All others html pages have a macro named content, called by the
template.html.

The line error reported by phptal:debug is good if the error is into
template.html
But, if the error is into the macro of another file, this go at the
wrong line of the html file.

There is a trick to have the good line ?


phptal:debug works only within one file. If you're calling template for  
another file, you need to add phptal:debug in that other file too.


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Re: assigned fields

2008-10-14 Thread Kornel Lesiński

On 13-10-2008 at 22:57:29 admi [EMAIL PROTECTED] wrote:


Thanks! But..

Context.php -

 public function __get($varname)
{
var_dump(Trying to get something!);
return huh?;
if ($varname == 'repeat')
return $this-__repeat;

 ...
}

Doesn't display anything like Trying to get something! or huh? as  
__get method is used for getting unaccessible class members.

Am I wrong?


You're right. You'll need to change __set as well and make it store  
variables in a private object/array to prevent this.


--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal