From: messju mohr Date: 2004-01-17T04:47:20+09:00 Subject: Re: HTML templating that works in more than one language? On Fri, Jan 16, 2004 at 11:46:14PM +0900, Lothar Scholz wrote: > Hello Ruby, > > Friday, January 16, 2004, 4:29:56 AM, you wrote: > > RB> Has anyone seen an HTML templating system that would be > RB> usable from Ruby *AND* PHP and perhaps other languages? > > RB> So far, if you want your HTML templates to do anything > RB> more than simple variable replacement that the template > RB> language becomes a lot like the language it's written in. > > RB> I'm thinking particularly of Smarty (for PHP): > RB> http://smarty.php.net/manual/en/smarty.for.designers.php > > RB> Do you think a Ruby class could ever parse Smarty templates, > RB> including basic 'each' logic like this:? > RB> http://smarty.php.net/manual/en/language.function.foreach.php > > RB> Any other advice appreciated. > RB> This is just for HTML templates, that need logic and loops, > RB> but we might have a project that uses both Ruby and PHP, > RB> and of course we don't want to re-write HTML templates > RB> for each. > > > I doubt that this is usefull because you must embedd a complete > php interpreter in ruby. smarty converts templates written in it's own language to php-code and runs this php-code. there is no php-code in a smarty-template. if a ruby class converts the same template to ruby-code no php-interpreter is needed. but smarty was written with 100% php in mind. the structures may not map that nicely to ruby. but i'm sure it's possible if somebody want to put the effort in it. greetings messju > The only way to go seems to be the amrita way with a templating engine > that works on pure html. I know that there is something for python > (the ZTL Zope Template Language). > > > -- > Best regards, > Lothar mailto:mailinglists@scriptolutions.com