Hello,

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

<div id="<?php echo $id ?>" />

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

<div id="${id}" />

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. <input value="${value}"/> instead of
                 * <input value="<?php echo $value ?>"/>
                 */
                $___content = file_get_contents($___viewFn);
                $___content = preg_replace('/\${([^}]+)}/','<?php echo \$$1
?>',$___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
-~----------~----~----~----~------~----~------~--~---

Reply via email to