Re: [SMARTY] generating php
| From: | Monte Ohrt | Date: | Sat, 08 Jun 2002 17:50:27 +0000 |
| Subject: | Re: [SMARTY] generating php | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4699@lists.php.net to get a copy of this message | ||
If you're just looking to search/replace some strings in a file, Smarty would be way overkill. You might be able to get a few ideas from it's parser, but more likely you can do everything you need with preg_replace().
Travis Low wrote:
It's for an application installer. I needed to replace one or two include paths in a php file. Smarty seemed ideal for the job, but I got a zillion errors. Worked great with the .ini file, though. I tried adjusting the $php_handling, to no avail. I already use {{ and }} because it's easier on my eyes. I ended up using str_replace( "%%doowah%%", "the actual doowah", $the_string ). Call it primitive templating. Here's a preview version: <http://dawnstar.org/willow-installer.tgz>. Extract under your webroot somewhere, then point your browser to: <http://yourserver/under/your/webroot/somewhere/willow-installer/install>. Should work, but not guaranteed yet (couple more things to do, should finish tonight). cheers, Travis Martijn van Zal wrote:-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.Hahahaha, Let me get this straight.... U write a program using PHP, you combine this with a template engine which produces PHP code, with the purpose of let that produced PHP code produce PHP code? Seems a little complicated to me, and I'm very curious why you wan't to use it. But it seems possible to me. I think you have to adjust the $php_handling variable to SMARTY_PHP_PASSTHRU, and you might want to change the delimiter tags, because { and } are not really practical. Maybe {{ and }} is better. Let us know if it worked out, I'm very curious. Greets, ____________________________________________Martijn van Zal GFXartist networkTechnical manager Mail: Martijn@gfxartist.com Icq: 8213621 -----Original Message----- From: Travis Low [mailto:travis@dawnstar.org] Sent: zaterdag 8 juni 2002 5:10 To: smarty-general@lists.php.net Subject: [SMARTY] generating php Anyone out there using Smarty to generate PHP code? I don't think it's possible, but I wanted to check. cheers, Travis