this is *almost* what im looking for
trouble is, im running a windoze XP box.... is there any way to do the
'greater than' output to file thing in windoze?
and the other trouble is that if i want to perform that action from a php
script i have to use 'exec', which is not ideal if i want to move the script
to a *nix server some time in the future (which is highly likely)
the biggest issue is that running the script from any directory other than
the directory in which the page to export resides plays merry havoc with the
document relative paths in the script.
perhaps i should clarify - i have an entire website designed in php, built
off a mysql database, complete with a stack of includes and images and
what-have-you. the problem is that the hosting available to the organisation
that the website is for decided to pull the pin on their previous hosting
plan and are not willing to shell the extra $ for php/mysql hosting. my idea
then was to create this script which parses every single php page it can
become aware of (i had to adjust the databases and scrips a little bit to
respond to a $htmldump flag) and then creates new page names based on
obvious content. it then creates a table of all of the pages it created and
what those pages were created from... say for eg:
"page.php?frame=listbuild.php&hw_type=printers " becomes "printerslist.htm".
the script then looks through ALL of the newly created html pages for links
that belong to the old php site and updates them to the corresponding html
link, as well as copying other files and folders to recreate the site
structure.
the way the script is designed (and i might add that although it is
functional it is one piss poor piece of programming and i am embarrassed to
show it to people) is such that it MUST reside in the same directory as the
website it is dumping. i can see no other way to do it with output buffers
and includes (as i have been doing) without rewriting the entire website to
take into account the relocation of the output script. i REALLY do not want
to do this.
thank you very much for the reply though. i will definitely investigate
whether this will work as a band-aid solution.
sticks
"Shawn Wilson" <sh***@glassgiant.com> wrote in message
news:3F***************@glassgiant.com...
Sticks wrote:
[re-ordered you post because top-posting is evil :o)] <xyzzy> wrote in message news:Xf********************@comcast.com...
"Sticks" <sa**********@yahoo.com> wrote in message
news:3f********@usenet.per.paradox.net.au...
> ok... im not quite sure how to describe my problem.
> i have a php script that runs through my entire php site and writes
the > resulting output to html files. this is necessary as the nature of
the > hosting available to me for this particular page prohibits me from
using > php/mysql as i would like.
>
> my script works simply by using output buffers and an include
> the relevant section of code is as follows:
>
> ob_start();
> include($source.$pagename);
> $page_buffer = ob_get_contents();
> ob_end_clean();
>
> i was wondering if there is a way i can do this without using the include, > because the script only works when it is in the same directory as
the site.
> this arrangement does not suit me, as i would rather be able to
store the > script in a separate folder.
>
>
>
>
>
My first thought is to create an array with your directory names that
you want to scan
$allDirs =
array("/usr/local/apache/htdocs","/usr/local/apache/site1/","/usr/local/apac he/site1/htdocs") etc...
then iterate through the array and subsequent directory files.
while (list(,$dirName) = each($allDirs) {
// create an array of all files
$allFiles = scandir($dirName);
while (list ($key,$fileName) = each($allFiles) {
// each file within each directory
$page_buffer to $fileName stuf......
}
}
perhaps i havent been clear enough
i dont want to use includes to perform this task. i would like to get
the html output of a php script that is quite complicated and uses a variety
of includes of its own which i do not wish to rewrite unless i absolutely
have to. these includes are disturbed when my script resides in a different
directory to the page.
as it stands, the script works. it just isnt an ideal solution.
i am looking for something along the lines of the exec() command, only
for executing php scripts.
I'm not sure I understand your problem, but if you want to execute php
scripts on Linux, you can use
/pathinfo/php -q /pathinfo/scriptname.php
from the command line or a cron job. The "-q" suppresses HTTP headers.
Or you could do:
/pathinfo/php -q /pathinfo/scriptname.php > index.html
to send all output from that php script to a file called index.html. Be
careful with this, though, as it's easy to overwrite the wrong files...
HTH,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com