Re: Re: [PHP] script preprocessor?
On Wednesday 29 August 2001 20:15, [EMAIL PROTECTED] wrote: > I do not need a cmd-line utility but something I can use _in_ a PHP4 > script without the need to apply changes to the interpreter or weird > system interfaces. Something similiar to the #define preprocessing > instructions of cc (or hopefully more flexible) would suit my needs. Well, it kind of *is* like C's #define - it adds a kind of "compilation" step to the entire process. Preprocess all the scripts and then you upload them to the server. The problem with comparing things to C is that C is a compiled language anyway :) > If your programm can substitute script parts during a page request > it'd be nice if you could pass me a source copy. No, it can't. > Personally I've no idea how such a facility could be implemented if > not being part of the PHP core. if (FOOBAR == 42) { include ("code1.php"); } else { include ("code2.php"); } -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) CPU not found. retry, abort, ignore? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: Re: [PHP] script preprocessor?
I do not need a cmd-line utility but something I can use _in_ a PHP4 script without the need to apply changes to the interpreter or weird system interfaces. Something similiar to the #define preprocessing instructions of cc (or hopefully more flexible) would suit my needs. If your programm can substitute script parts during a page request it'd be nice if you could pass me a source copy. Personally I've no idea how such a facility could be implemented if not being part of the PHP core. D. Alvarez Arribas <[EMAIL PROTECTED]> >I've written one for my personal needs. Supports replacement of constants >("{{$ foobar }}") with arbitrary text, conditionals >("{{%if foobar == 42 }} ... {{%else }} ... {{%endif }}"), comment >removal, removal of unneccessary whitespace, removal of assertions and >replacement of an error handler function ("sgError ($Msg)" => "MyError >(__FILE__, __LINE__, $Msg)") >> How can I declare optional parameters as used by strpos, substr, etc. >> to specify the offset? I do not want to have to preceed some functions >> with the @-operator, and preceeding all for consistency wouldn't be an >> option, I think. Is it possible at with user-defined functions? >> >> quick help is appreciated. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] script preprocessor?
On Wednesday 29 August 2001 12:24, [EMAIL PROTECTED] wrote: > Is there a macro preprocessor that can be used to substitute arbitrary > sections of code with different code? define is documented as working > for rvals only and my attempts to produce something more meaty lead to > parse errors. I've written one for my personal needs. Supports replacement of constants ("{{$ foobar }}") with arbitrary text, conditionals ("{{%if foobar == 42 }} ... {{%else }} ... {{%endif }}"), comment removal, removal of unneccessary whitespace, removal of assertions and replacement of an error handler function ("sgError ($Msg)" => "MyError (__FILE__, __LINE__, $Msg)") Written for Linux, needs GNU NANA (http://wattle.cs.ntu.edu.au/homepages/pjm/nana-home/) and expat (http://www.jclark.com/xml/expat.html). I can send you a copy of the source if you want. -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) "use the source, luke." (obi-wan gnuobi) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]