Re: Container functions....

From: Date: Sun, 10 Aug 2003 23:46:21 +0000
Subject: Re: Container functions....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159078@lists.php.net to get a copy of this message
Sounds like you're trying to replicated something in ColdFusion? I have a few blocks of code on my pages which are only executed on my development server, not the live server -- is this what you want? if(ereg("192.168.0.",$_SERVER['SERVER_ADDR'])) { $local = 1; } else { $local = 0; } if($local) { // do whatever you want } Justin On Monday, August 11, 2003, at 12:50 AM, Mike Morton wrote:
In a language that I used to program in - for development we used to be able to make a function that basically just executed everything inbetween: <hidecode> Print "This is html printed" <some programming code> Print "this is more code"; </hidecode> So basically everything in between hidecode and /hidecode is executed the same as if the hide code did not exist - except that the hidecode container would be something like: Function hidecode() {
    if(getenv("remoteaddress")=="myaddress") {
        %s (all code contained within the tags)
    }
} So - the question is does PHP have some way that I cannot see to do this? I realize that I could create a function and pass everything in as an argument - but that would involve putting everything into variables, and overall being just a pain in the ass to add and remove the container. Is PHP too sophisticated a language to be able to do this easily and quickly? Or am I just missing some form of function that is totally obvious? Finally - yes, I know that I could slap an if tag around it - but that is also a big pain in the ass to add and remove each if tag when you go 'live' with the change, as opposed to a quick find and replace with a container function like this... TIA


« previous php.general (#159078) next »