On 12/18/06, Fahad Pervaiz <[EMAIL PROTECTED]> wrote:
I have written a framework for internationalization. Now i have incoorperate
it into and existing system that is huge and it will take alot of time to
change ECHO to a function call, so i want to override its implementation so
that i can use it for my own purposes with having to change all the echo
calls

At 12/18/2006 10:01 PM, Casey Chu wrote:
You could try to manipulate what the echo's output by ob_start(), etc.
Or maybe you could change the standard output?


Given the probably unalterable nature of echo, I'd say Casey's suggestion of buffering output and running it through a post-processor is an excellent one. However my first choice would probably be to bite the bullet and globally replace echo with my own function. Once that painful step is taken, you can modify the output methodology to your heart's content.

This sounds like an excellent object lesson in the separation of logic from markup. If you design your applications to first figure out what to output and then to output it as one or more solid lumps, you can more easily tweak the logic or the markup or the output method without messing with the others. It can be hard medicine to swallow the first time, but it will make you a leaner & cleaner coder.

Regards,
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to