Re: Calling PHP from PHP

From: Date: Thu, 12 Apr 2007 06:30:12 +0000
Subject: Re: Calling PHP from PHP
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-27674@lists.php.net to get a copy of this message
Sidenote: You can also do: $dir = "folder/of/include/files"; $files = opendir($dir); while ($file = readdir($file)): if (substr($file,-4) == '.php'):
      include_once($dir.'/'.$file);
endif; endwhile; but I wouldn't recommend it. :P Mike John Comerford skrev:
Yes, what you have described should work fine...... sam rumaizan wrote:
1- I have 50 php pages.
  2- I want to include all 50 php pages in my main page.         include("1.php"); ......  include("50.php");
  My question is:      can I put all of the include php pages in one php page and save it as includepages.php then include this php page to my main page include("includepages.php"); instead of listing all of the 50 pages    include("1.php"); ......  include("50.php"); in my main page.
    Hartleigh Burton <hburton@mraentertainment.com> wrote:
Not sure if i understand properly... you don't want to use the include () function or you don't want to have the code of script B in script A? If it is the later you can use include("path/to/scriptB.php"); or require("path/to/scriptB.php"); you can also use include_once() and require_once() if you want to make sure that script B is not used more than once. If you don't want to use the include() or require() functions then I am not really sure. I guess (providing you havn't already output headers) you could use header() to direct the browser... or if headers have already been sent you could use javascript to do a redirect?! On 12/04/2007, at 3:18 PM, Alf Stockton wrote:
Please tell me how I call one PHP script from another? On successful completion of script A I need to call script B without including it as part of script A. -- Regards, Alf Stockton www.stockton.co.za Be cheerful while you are alive. -- Phathotep, 24th Century B.C. My email disclaimer is available at www.stockton.co.za/disclaimer.html -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
    
Regards, Hartleigh.
       ---------------------------------
Don't get soaked.  Take a quick peak at the forecast  with theYahoo! Search weather shortcut.
  


« previous php.windows (#27674) next »