[PHPTAL] Inject PHP Code into template?

2009-02-02 Thread Christian Welzel
Hi there,
is there a way to inject PHP code into the template during compiiation?
I want to make a date: helper for phptal which uses Zend_Date for 
convertions. But creation of Zend_Date is a bit expensive, so i want to
create an instance on the begin of the template file and use it later in the
helper.
How can this be done?

-- 
 MfG, Christian Welzel

  GPG-Key: http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15

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


Re: [PHPTAL] Inject PHP Code into template?

2009-02-02 Thread admirau

W dniu 2009-02-02 18:31, Christian Welzel pisze:

Hi there,
is there a way to inject PHP code into the template during compiiation?
I want to make a date: helper for phptal which uses Zend_Date for
convertions. But creation of Zend_Date is a bit expensive, so i want to
create an instance on the begin of the template file and use it later in the
helper.
   

Create a class and execute method where you need:
span tal:content=php: SomeClass::staticMethod()-MM-DD/span

Use class methods, just replace - with dots.

If you want to inject on the fly, you have to write pre-filter with 
regex or parse DOM.


Further reading:
http://phptal.motion-twin.com/manual/en/#tales-php
http://phptal.motion-twin.com/manual/en/#tales-structure
http://taat.pl/article/zend_framework_tutorial/

--
reagards,
takeshin

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


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

 Hi there,
 is there a way to inject PHP code into the template during compiiation?
 I want to make a date: helper for phptal which uses Zend_Date for
 convertions. But creation of Zend_Date is a bit expensive, so i want to
 create an instance on the begin of the template file and use it later in
 the
 helper.


 Create a class and execute method where you need:
 span tal:content=php: SomeClass::staticMethod()-MM-DD/span

 Use class methods, just replace - with dots.

 If you want to inject on the fly, you have to write pre-filter with regex
 or parse DOM.

 Further reading:
 http://phptal.motion-twin.com/manual/en/#tales-php
 http://phptal.motion-twin.com/manual/en/#tales-structure
 http://taat.pl/article/zend_framework_tutorial/

 --
 reagards,
 takeshin


 ___
 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] Inject PHP Code into template?

2009-02-02 Thread Christian Welzel
Am Montag 02 Februar 2009 schrieb Iván -DrSlump- Montes:
 The PHPTAL way would be to create a custom tales modifier [1],

Exactly thats what i want to do.


-- 
 MfG, Christian Welzel

  GPG-Key: http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15

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