Re: [PHPTAL] Preloading a macros file ?

2008-10-10 Thread Guillaume Lecanu
Le vendredi 10 octobre 2008 à 10:39 +0100, Kornel Lesiński a écrit :

 On 10-10-2008 at 10:25:36 Guillaume Lecanu [EMAIL PROTECTED] wrote:
 
  I have a file macros.html with all my macros for our website.
  But this is really annoying to call each macros like this :
  metal:use-macro=../../macros.html/name_of_my_macro
 
  There is a solution to force to load macros.html and to call the macro
  everywhere like this :
  metal:use-macro=name_of_my_macro  ?
 
 This is possible:
 
 $phptal-m = '../../macros.html/';
 
 metal:use-macro=${m}name_of_my_macro

Hi Kornel,

Thanks for this trick, I'll uses it if there is really not other way.
Do you think it's possible to patch PHPTAL to force to read the file(s)
of our choices ?

If PHPTAL read it, I suppose all readed macros will be saved in memory,
and so we should uses it everywhere without the need of ${m};

Thanks for your help



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


Re: [PHPTAL] Preloading a macros file ?

2008-10-10 Thread Kornel Lesiński

On 10-10-2008 at 15:46:10 Guillaume Lecanu [EMAIL PROTECTED] wrote:


If PHPTAL read it, I suppose all readed macros will be saved in memory,
and so we should uses it everywhere without the need of ${m};


You could try to hack PHPTAL::executeMacro() function - get base function  
name that your macro template file uses (the same way that executeMacro)  
does it), store it somewhere, and then when local macro is executed, and  
local function doesn't exist, instead of throwing an exception, retry with  
another function name.


I've made some changes to this function today, so use SVN version of  
PHPTAL.


--
regards, Kornel

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


Re: [PHPTAL] Preloading a macros file ?

2008-10-10 Thread Kornel Lesiński

On 10-10-2008 at 10:25:36 Guillaume Lecanu [EMAIL PROTECTED] wrote:


I have a file macros.html with all my macros for our website.
But this is really annoying to call each macros like this :
metal:use-macro=../../macros.html/name_of_my_macro

There is a solution to force to load macros.html and to call the macro
everywhere like this :
metal:use-macro=name_of_my_macro  ?


This is possible:

$phptal-m = '../../macros.html/';

metal:use-macro=${m}name_of_my_macro

--
regards, Kornel

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


Re: [PHPTAL] Preloading a macros file ?

2008-10-10 Thread Guillaume Lecanu
Le vendredi 10 octobre 2008 à 16:05 +0100, Kornel Lesiński a écrit :

 On 10-10-2008 at 15:46:10 Guillaume Lecanu [EMAIL PROTECTED] wrote:
 
  If PHPTAL read it, I suppose all readed macros will be saved in memory,
  and so we should uses it everywhere without the need of ${m};
 
 You could try to hack PHPTAL::executeMacro() function - get base function  
 name that your macro template file uses (the same way that executeMacro)  
 does it), store it somewhere, and then when local macro is executed, and  
 local function doesn't exist, instead of throwing an exception, retry with  
 another function name.
 
 I've made some changes to this function today, so use SVN version of  
 PHPTAL.

Ok, thanks for your help.
I'll try to see what I can do.

Have a good we.
++


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