johnsiilver Posted May 16, 2006 Share Posted May 16, 2006 I'm attempting to do something that other languages like python seem to make easy, and so I'm sure php has a way to do it, though I've never seen code that does.What I want to be able to do is write modules that include functions, sometimes just one function. Ex:===================file: example.php===================function blah(){ echo "blah";}blah();==================I want to be able to call the function blah() from another file, but I don't want the function call to blah() that is in the file to happen when I do the include("example.php") in whatever file that is going to call the blah() function.The reason I want to do this is I write a bunch of functions all in seperate files that get called by an index.php page and puts all the output of the functions in a dom draggable <div>. But I also want to be able to access the function on it's own page by directly navigating to the module. Is there some way to not execute a piece of code if it's being caused by an include() or require()?Thanks. Link to comment https://forums.phpfreaks.com/topic/9806-running-a-function-from-within-a-module-except-when-part-of-an-include/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.