imryn Posted May 5, 2007 Share Posted May 5, 2007 Hello, I need to call a "rotate.php" file from my index.php file and I am not sure of the best way to do this, any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/ Share on other sites More sharing options...
MadTechie Posted May 5, 2007 Share Posted May 5, 2007 What do you mean by "Call", heres you basic options include("file.php"); require("file.php"); include_once("file.php"); require_once("file.php"); but if you need to use one of the above before you make call to any functions, Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-245967 Share on other sites More sharing options...
imryn Posted May 6, 2007 Author Share Posted May 6, 2007 If I use a one of these options include("file.php"); require("file.php"); include_once("file.php"); require_once("file.php"); can I then do this <Body OnLoad="Rotate.php"> ? Best Regards! Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-246458 Share on other sites More sharing options...
triphis Posted May 6, 2007 Share Posted May 6, 2007 onLoad is normally associated with Javascript.... it wouldn't have any affect with a php file. what are you trying to achieve by this? If you want a function that exists within a php file to occur when a page is loaded, you should include that file with one of the methods that have been shown to you... and then manually call the required function(s) for what you need. ie: litterally type functionName() somewhere in your document after the inclusion... Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-246459 Share on other sites More sharing options...
warewolfe Posted May 6, 2007 Share Posted May 6, 2007 Are you confusing Rotate.php with a function call? What does Rotate.php do? Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-246460 Share on other sites More sharing options...
imryn Posted May 7, 2007 Author Share Posted May 7, 2007 Triphis, thank you, I think I understand now what was being said... you cleared up my confusion, I did not realize I could to the #include("rotate.php") then in my code just call the function to start the script. Here the story, I have rotate.php that lives in the image dir, and when it is called it displays a different image to the web browser everytime it is called. I originally had a javascript that I had to everyday load 3 new images into an array to display on the index page every 35 seconds, now I want to call rotate.php to do my dirty work. Is there another way or should I say a better way to do all of this? Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-246939 Share on other sites More sharing options...
MadTechie Posted May 7, 2007 Share Posted May 7, 2007 this post may be related it s banner rotator Quote Link to comment https://forums.phpfreaks.com/topic/50095-how-to-call-a-php-file-from-another-php-file/#findComment-246955 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.