Ask a Question related to PHP Development, Design and Development.
-
Emanuele D'Arrigo #1
Re: HTML file generation from PHP scripts
Thanks for the suggestion guys,
but I did forget an important detail.
I do not have access to a unix shell
so the whole thing must be self-contained
in the php script.
I could substitute my current 'echo'
statements with some kind of fprintf
function, so that the output is redirected
to a file, but I was trying to find out if
there was an easier way.
Let me know.
Ciao ciao!
Manu
Emanuele D'Arrigo Guest
-
Writing HTML with PHP, executing external scripts
I currently have a layout that is part written in SHTML - in other words, it gets processed by the web server to execute any calls for PHP or Perl... -
HTML Generation (Next Generation CGI)
Hi, This idea for the next generation of CGI has me thinking (see http://rubygarden.org/ruby?NextGenerationCGI). It seems that CGI would be best... -
HTML generation
Is there a list of all the different ways of outputting HTML in Ruby somewhere? I can think of using the "puts" statement, eRuby, and CGI. Any... -
Getting HTML source from web pages to include in my ASP scripts
I am running an ASP script which I require to get the source html from some URL so I can pick out bits of this and include the data in my webpage.... -
executing perl scripts from php/html
On Thu, 28 Aug 2003 01:57:49 -0500, in message <3f4da7e9$0$6524$afc38c87@news.optusnet.com.au>, the AI program named "Leandra"... -
Justin Koivisto #2
Re: HTML file generation from PHP scripts
Emanuele D'Arrigo wrote:
Are you able to write files in your webspace through PHP? (IE create if> Thanks for the suggestion guys,
> but I did forget an important detail.
>
> I do not have access to a unix shell
> so the whole thing must be self-contained
> in the php script.
>
> I could substitute my current 'echo'
> statements with some kind of fprintf
> function, so that the output is redirected
> to a file, but I was trying to find out if
> there was an easier way.
>
> Let me know.
>
> Ciao ciao!
>
> Manu
non-exist, or overwrite if it does.)
If so, then "Default User" just gave you the method. If not, then your
best bet is to either switch hosts, or set up a development site on your
computer. THen when you have done updates to the content, use something
like wget to grab a static copy to upload.
--
Justin Koivisto - [email]spam@koivi.com[/email]
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Justin Koivisto Guest
-
Default User #3
Re: HTML file generation from PHP scripts
Emanuele D'Arrigo wrote:What do you mean? There's no need to have shell access as long as you>
> Thanks for the suggestion guys,
> but I did forget an important detail.
>
> I do not have access to a unix shell
> so the whole thing must be self-contained
> in the php script.
can read and write to files on the host. Please explain your situation
fully.
Easier way? What exactly are you looking for? There's no magic, if you> I could substitute my current 'echo'
> statements with some kind of fprintf
> function, so that the output is redirected
> to a file, but I was trying to find out if
> there was an easier way.
want something saved from a prior execution you have to put somewhere.
For a situation like web pages, files are the natural way. Dump your
output to a file, serve it up if it's within the time window, recreate
it when it's not.
BTW, there's no fprintf() function, you'd be looking for fwrite() or
fputs(). Unless your code that constructs the output now is horribly
complicated, you should be able to rework it in less time than it takes
to agonize over it. You'd already be done.
Brian Rodenborn
Default User Guest
-
Andy Hassall #4
Re: HTML file generation from PHP scripts
On Thu, 26 Jun 2003 11:41:39 +0100, David Mackenzie
<dcm@tarbrax.freeserve.co.uk> wrote:
Have a look at this page in the Apache manual; not based on date and time, but>>>So I was wondering: having a functional script,
>>is there a way to re-direct its output to an html
>>file? Ideally, if the file is there already and
>>is less than 24 hrs old, the script should actually
>>redirect the browser to that file. Otherwise,
>>the script should generate one and then redirect
>>the browser to that file anyway.
>I understand that Apache's mod_rewrite can rewrite URLs based on date
>and time, but that is beyond my skill level.
it seems close to the OP's request:
[url]http://httpd.apache.org/docs-2.0/misc/rewriteguide.html#ToC2[/url]
Search for 'On-the-fly Content-Regeneration' about 2/3rds down the page.
--
Andy Hassall (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
Andy Hassall Guest
-
Default User #5
Re: HTML file generation from PHP scripts
Emanuele D'Arrigo wrote:
That's common, and should present no problems.> I can uploaded and download files to my account, via ftp,
> and of course I can run the scripts when I call them up
> trough the browser. But I do not have a telnet or ssh
> access to the server, which I believe it means I can only
> execute things inside a script.
That doesn't really fit your original problem description. What is wrong> Basically I'm looking for the php equivalent of
> the unix syntax: myScript.php > myFile.html
> where the output of the php script is redirected
> to a file. Is it possible to dump the result of
> a php script -executed- by another php script?
with opening the file and writing to it using the PHP file methods?
Why? Include that functionality in your formhandler the way I showed you> A startup script would be the one that check for
> the existance and age of the html file, and
> if necessary it would start the actual script and
> dump its output into the file overwriting it.
before.
> I see what you mean and thanks for the tip about fwrite and fputs.
> As I'm quite new to php I am not just trying to find a way to do it.
> Indeed I could probably easily substitute all my echo statement with
> an fwrite and get away with it, but I was wondering if there's an
> easier way that keep the current script the way it is, and runs it
> as described few paragraph earlier.
The easy way is to do it right. Then you'll have a correct, flexible way
of doing, so when the inevitable changes come up in the future you'll be
set.
I showed the basic framework, add another routine to open the output
file for writing, and change your echo statements to fputs. Just do it.
Like I said, you'd already be done if you just sat down and cranked on
it for a hour or so.
A decent text editor can help a lot in search and replace.
Brian Rodenborn
Default User Guest
-
Paul Liversidge #6
Re: HTML file generation from PHP scripts
[email]manu3d@mclink.it[/email] (Emanuele D'Arrigo) wrote in message news:<42485035.0306260053.5ed192f0@posting.google. com>...
Thinking out loud here so feel free to shoot the ideas down but if> So I was wondering: having a functional script,
> is there a way to re-direct its output to an html
> file? Ideally, if the file is there already and
> is less than 24 hrs old, the script should actually
> redirect the browser to that file. Otherwise,
> the script should generate one and then redirect
> the browser to that file anyway.
>
> Hints? Suggestions? Am I asking too much?
you've got a fuctional script then wrapping a little bit of ob_start
and ob_end could be a way around it.
It means that you could test for the file, if it exists and recent
enough, dump that to the browser via readfile (I think that's the
function that opens and dumps contents to the browser). If it needs
re-creating then use ob_start to redirect output, save the contents as
a file and display it.
I've never done it but these functions exist and this would be my
initial way of tackling the problem without rewriting the code. You
may want to search around for "cache" and "cacheing" as this is what
you're effectively setting up.
HTH
Paul Liversidge Guest
-
Emanuele D'Arrigo #7
Re: HTML file generation from PHP scripts
Paul, that sounds like exactly what I was looking for.
Thank you!
Manu
Emanuele D'Arrigo Guest



Reply With Quote

