Re: Nicer templates with TAL-like variables

2006-11-18 Thread gwoo

You can extend the view class.
Something like this

filename: phptal.php
path: /app/views/phptal.php


in /app/app_controller.php


There is a SmartyView class on the bakery you can follow as a guide.
Good luck


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Nicer templates with TAL-like variables

2006-11-18 Thread panyasan

Hello,

since the default templates are simply php-files, normal usage to
inject php-variables is to use, for example,



In a previous project, I used PHPTAL and could include variables in
templates this way:



which is much more readable.

I wrote a hack to include into view.php. line 700:

/*
 * hack CB to allow for nicer, TAL-like templates,
 * e.g.  instead of
 * 
 */
$___content = file_get_contents($___viewFn);
$___content = preg_replace('/\${([^}]+)}/','',$___content);
$___tmpFn  = CACHE . md5( $___viewFn ) . ".tmp";
file_put_contents ( $___tmpFn, $___content );

if (DEBUG) {
include ($___tmpFn);
} else {
@include ($___tmpFn);
}
unlink ($___tmpFn);
/** end hack **/

Now my questions are:

1) Is it possible to do this another way, without hacking cake source?
2) Has anyone integrated PHPTAL into cake yet?

Thanks,

Christian


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---