Re: [PHPTAL] How to disabe ${php: XXXX} forced echo?

2010-01-12 Thread Kornel Lesinski
On 11 Jan 2010, at 21:07, the...@spiffyjr.me the...@spiffyjr.me  
wrote:


Is there anyway to prevent PHPTAL from automatically echoing the  
result of

${php: }?


There's no explicit way to do it. You could wrap call in function that  
returns nothing (e.g. substr(,0,0)).



I have integrated PHPTAL with Zend Framework and Dojo but
have an issue when attempting to use dojo().onLoadCaptureStart().

// inline-content.tpl.html
tal:block
${helper: dojo().onLoadCaptureStart()}
function _initLoader() {
dojo.parser.parse(dojo.body());
dojo.fadeOut({
node: loader,
duration: 420,
onEnd: function() {
dojo.byId('loader').style.display = hidden;
dojo.byId('layoutContent').style.display = 
inherit;
}
}).play(25);
}
${helper: dojo().onLoadCaptureEnd()}


Does Dojo expect to get HTML/XML markup as input, or unescaped script?  
If the latter, you might get nasty surprise when you use '' or ''.



Oh, while I'm thinking
about it, is there a way to do multi-line ${} tags so I don't have  
to have

such a long line? Something like:

${structure helper:
 dojo().requireModule('dojo.parser')
   .requireModule('dijit.Form')}



I could add that.

--
regards, Kornel


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


Re: [PHPTAL] How to disabe ${php: XXXX} forced echo?

2010-01-12 Thread theman

That's unfortunate and something I feel needs addressed. Thanks for the
answer.

On Tue, 12 Jan 2010 09:56:45 +, Kornel Lesinski
kor...@aardvarkmedia.co.uk wrote:
 On 11 Jan 2010, at 21:07, the...@spiffyjr.me the...@spiffyjr.me  
 wrote:
 
 Is there anyway to prevent PHPTAL from automatically echoing the  
 result of
 ${php: }?
 
 There's no explicit way to do it. You could wrap call in function that  
 returns nothing (e.g. substr(,0,0)).
 
 I have integrated PHPTAL with Zend Framework and Dojo but
 have an issue when attempting to use dojo().onLoadCaptureStart().

 // inline-content.tpl.html
 tal:block
 ${helper: dojo().onLoadCaptureStart()}
  function _initLoader() {
  dojo.parser.parse(dojo.body());
  dojo.fadeOut({
  node: loader,
  duration: 420,
  onEnd: function() {
  dojo.byId('loader').style.display = hidden;
  dojo.byId('layoutContent').style.display = 
 inherit;
  }
  }).play(25);
  }
 ${helper: dojo().onLoadCaptureEnd()}
 
 Does Dojo expect to get HTML/XML markup as input, or unescaped script?  
 If the latter, you might get nasty surprise when you use '' or ''.
 
 Oh, while I'm thinking
 about it, is there a way to do multi-line ${} tags so I don't have  
 to have
 such a long line? Something like:

 ${structure helper:
  dojo().requireModule('dojo.parser')
.requireModule('dijit.Form')}
 
 
 I could add that.

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


Re: [PHPTAL] How to disabe ${php: XXXX} forced echo?

2010-01-12 Thread Kornel Lesinski

On 12 Jan 2010, at 16:02, the...@spiffyjr.me wrote:

Thanks for the advice. I'd prefer to go with method #1 because that  
is how
I was previously rendering templates with Zend_View. The echo issue  
still
remains, however. If I use ${dojo().onLoadCaptureEnd()} then I get  
random
1 outputs everywhere because onLoadCaptureEnd() returns true. This  
is
rather unfortunate because dojo information is rendered all over the  
place

in Zend. For example,


This can be easily solved:

function noecho($anything)
{
return '';
}

${php:noecho(dojo.onLoadCaptureEnd())}

or more fancy:

function phptal_tales_noecho($expr)
{
$code = phptal_tales('php:' . $expr);
return  ''.(($code)0) ; // PHP doesn't have comma operator
}

${noecho:dojo.onLoadCaptureEnd())


--
regards, Kornel


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


[PHPTAL] How to disabe ${php: XXXX} forced echo?

2010-01-11 Thread theman

Is there anyway to prevent PHPTAL from automatically echoing the result of
${php: }? I have integrated PHPTAL with Zend Framework and Dojo but
have an issue when attempting to use dojo().onLoadCaptureStart().

// inline-content.tpl.html
tal:block
${helper: dojo().onLoadCaptureStart()}
function _initLoader() {
dojo.parser.parse(dojo.body());
dojo.fadeOut({ 
node: loader,
duration: 420,
onEnd: function() {
dojo.byId('loader').style.display = hidden;
dojo.byId('layoutContent').style.display = 
inherit;
}
}).play(25);
}
${helper: dojo().onLoadCaptureEnd()}
${structure helper:
dojo().requireModule('dojo.parser').setDjConfigOption('parseOnLoad',
false).setCdnBase(Zend_Dojo::CDN_BASE_AOL).setCdnVersion('1.4.0').addStyleSheetModule('dijit.themes.tundra')}
${structure helper: inlineScript()}
/tal:block

This code works perfectly fine but the method
$this-dojo()-onLoadCaptureEnd() returns true which outputs a 1 to my
page. Is there anyway to disable this behavior? Oh, while I'm thinking
about it, is there a way to do multi-line ${} tags so I don't have to have
such a long line? Something like:

${structure helper: 
  dojo().requireModule('dojo.parser')
.requireModule('dijit.Form')}

Regards,

Charles K Spraggs

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