Seeking a function, class or other means to save the current PHP page as an HTML file on the server.
Seeking a function, class or other means to save the current PHP page as an HTML file on the server.
am 07.03.2008 02:21:28 von Greg Cocks
------_=_NextPart_001_01C87FF1.91B1170E
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hello,
=20
I am seeking a function, class or other means to save the current PHP
page as an HTML file on the server.
=20
The user, via a button, could then 'download' this page much like if
they had gone to their "File... Save Page As.." menu to save it locally.
=20
This is for a (dynamic) page that I have written in PHP that formats and
presents some query results - and the results presented vary based on
the user's selection of parameters on an earlier page.
=20
Any suggestions?
=20
This 'one click' menu is for users "resistant" to learning how to do the
"File... Save Page As..." method...
=20
Thanks in advance!
=20
----------
Regards,
GREG COCKS
GIS Analyst V
gcocks | at | stoller.com =20
S. M. Stoller Corp
105 Technology Drive, Suite 190
Broomfield, CO 80021
www.stoller.com =20
303-546-4300
303-443-1408 fax
303-546-4422 direct
303-828-7576 cell
=20
------_=_NextPart_001_01C87FF1.91B1170E--
Re: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 02:40:04 von Michael Southworth
------=_Part_3084_11231129.1204854004616
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
As a quick answer, I think the easiest way is to have a link reload the
page, with a flag to set the content disposition header.
See:
http://us3.php.net/header
Example #1
It should be fairly straightforward from there. If I do recall, there may be
some quirks with IE, a quick google should bring up any workarounds.
If you cannot allow a refresh, the solution may be far more complicated,
using the document object model in javascript, or php output control. In
that case, I would ask your users to just use the Save-as function instead.
HTH,
-Michael
On Thu, Mar 6, 2008 at 5:21 PM, Greg Cocks wrote:
> Hello,
>
>
>
> I am seeking a function, class or other means to save the current PHP
> page as an HTML file on the server.
>
>
>
> The user, via a button, could then 'download' this page much like if
> they had gone to their "File... Save Page As.." menu to save it locally.
>
>
>
> This is for a (dynamic) page that I have written in PHP that formats and
> presents some query results - and the results presented vary based on
> the user's selection of parameters on an earlier page.
>
>
>
> Any suggestions?
>
>
>
> This 'one click' menu is for users "resistant" to learning how to do the
> "File... Save Page As..." method...
>
>
>
> Thanks in advance!
>
>
>
> ----------
> Regards,
> GREG COCKS
> GIS Analyst V
> gcocks | at | stoller.com
> S. M. Stoller Corp
> 105 Technology Drive, Suite 190
> Broomfield, CO 80021
> www.stoller.com
> 303-546-4300
> 303-443-1408 fax
> 303-546-4422 direct
> 303-828-7576 cell
>
>
>
>
------=_Part_3084_11231129.1204854004616--
Re: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 04:00:33 von Trevor Gryffyn
Yeah, the trick is you want to force the download. If you send HTML or text
without setting the disposition properly, it'll just display in the
browser. Maybe something like this will help:
http://www.boutell.com/newfaq/creating/forcedownload.html
Good luck!
-TG
----- Original Message -----
From: "Michael Southworth"
To: "Greg Cocks"
Cc: php-windows@lists.php.net
Date: Thu, 6 Mar 2008 17:40:04 -0800
Subject: Re: [PHP-WIN] Seeking a function, class or other means to save the
current PHP page as an HTML file on the server.
> As a quick answer, I think the easiest way is to have a link reload the
> page, with a flag to set the content disposition header.
> See:
> http://us3.php.net/header
> Example #1
> It should be fairly straightforward from there. If I do recall, there may be
> some quirks with IE, a quick google should bring up any workarounds.
>
> If you cannot allow a refresh, the solution may be far more complicated,
> using the document object model in javascript, or php output control. In
> that case, I would ask your users to just use the Save-as function instead.
>
> HTH,
> -Michael
>
> On Thu, Mar 6, 2008 at 5:21 PM, Greg Cocks wrote:
>
> > Hello,
> >
> >
> >
> > I am seeking a function, class or other means to save the current PHP
> > page as an HTML file on the server.
> >
> >
> >
> > The user, via a button, could then 'download' this page much like if
> > they had gone to their "File... Save Page As.." menu to save it locally.
> >
> >
> >
> > This is for a (dynamic) page that I have written in PHP that formats and
> > presents some query results - and the results presented vary based on
> > the user's selection of parameters on an earlier page.
> >
> >
> >
> > Any suggestions?
> >
> >
> >
> > This 'one click' menu is for users "resistant" to learning how to do the
> > "File... Save Page As..." method...
> >
> >
> >
> > Thanks in advance!
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 04:40:36 von Greg Cocks
------_=_NextPart_001_01C88005.019053EE
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Thanks so much to all for the replies...
=20
Michael's method works work for a static page... but as the (*.php) page
gets data from a PostgreSQL database to display it "breaks", not
unreasonably, when it is saved using this method as a *.html.
=20
Fun to learn new stuff... I am off to try and learn how I can make this
work, with the leads provided... :-)
=20
In the *meantime*, under the "Save As HTML" icon I have put some text
letting the user know about File... Save Page As... (or ... Save As...)
=20
I am going to look at maybe using this method with a PDF generation
method to 'make' the page as a PDF for them to download...
=20
Thanks again... what a resource...
=20
Regards,
GREG COCKS
gcocks | at | stoller.com =20
=20
________________________________
From: Michael Southworth [mailto:mikesouthworth@gmail.com]=20
Sent: Thursday, March 06, 2008 6:40 PM
To: Greg Cocks
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Seeking a function, class or other means to save
the current PHP page as an HTML file on the server.
=20
As a quick answer, I think the easiest way is to have a link reload the
page, with a flag to set the content disposition header.
See:
http://us3.php.net/header
Example #1
It should be fairly straightforward from there. If I do recall, there
may be some quirks with IE, a quick google should bring up any
workarounds.
If you cannot allow a refresh, the solution may be far more complicated,
using the document object model in javascript, or php output control. In
that case, I would ask your users to just use the Save-as function
instead.
HTH,
-Michael
On Thu, Mar 6, 2008 at 5:21 PM, Greg Cocks wrote:
Hello,
I am seeking a function, class or other means to save the current PHP
page as an HTML file on the server.
The user, via a button, could then 'download' this page much like if
they had gone to their "File... Save Page As.." menu to save it locally.
This is for a (dynamic) page that I have written in PHP that formats and
presents some query results - and the results presented vary based on
the user's selection of parameters on an earlier page.
Any suggestions?
This 'one click' menu is for users "resistant" to learning how to do the
"File... Save Page As..." method...
Thanks in advance!
----------
Regards,
GREG COCKS
GIS Analyst V
gcocks | at | stoller.com
S. M. Stoller Corp
105 Technology Drive, Suite 190
Broomfield, CO 80021
www.stoller.com
303-546-4300
303-443-1408 fax
303-546-4422 direct
303-828-7576 cell
=20
------_=_NextPart_001_01C88005.019053EE--
RE: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 05:58:52 von Trevor Gryffyn
If by 'breaks' you mean that it's not saving as a .HTML file, you should be
able to set the filename in the header when you force the download.
If that's not it, if you care to elaborate, maybe we can give a better
suggestion.
-TG
----- Original Message -----
From: "Greg Cocks"
To:
Date: Thu, 6 Mar 2008 20:40:36 -0700
Subject: RE: [PHP-WIN] Seeking a function, class or other means to save the
current PHP page as an HTML file on the server.
> Thanks so much to all for the replies...
>
>
> Michael's method works work for a static page... but as the (*.php) page
> gets data from a PostgreSQL database to display it "breaks", not
> unreasonably, when it is saved using this method as a *.html.
>
>
> Fun to learn new stuff... I am off to try and learn how I can make this
> work, with the leads provided... :-)
>
>
> In the *meantime*, under the "Save As HTML" icon I have put some text
> letting the user know about File... Save Page As... (or ... Save As...)
>
>
> I am going to look at maybe using this method with a PDF generation
> method to 'make' the page as a PDF for them to download...
>
>
> Thanks again... what a resource...
>
> Regards,
>
> GREG COCKS
>
> gcocks | at | stoller.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 19:52:58 von Greg Cocks
Cheers TG,
The query page is a form that gather the user selections, queries a
PostgreSQL database using them, and returns some analytical data as an
array which I serialise into a text file.
The results page, the one I want to let the user save as an HTML 'file'
is a PHP page that unserialises the data out of the array from the text
file, and displays it in some formatted tables, one sub-table per data
row (1 row to many hundreds) - as well as some SESSION variables, etc of
the SQL string used to get the data (as a user reference) and the logged
on user name & date, a list of some reference data (what the qualifers,
etc mean) pulled directly out of the database, etc, etc.
Using the File... Save Page As... method in the browser works well
enough to save the HTML as a file/directory pair (although if you open
separately, it looses track of the CSS file of course...)
The 'breakage' is that because the results page file needs to be a PHP
to unserialise the array, get the reference data from the database, etc,
etc if you save it as an HTML page using the header / disposition method
it displays all the pure HTML just fine of course - but gags on the PHP,
thinking it is HTML...
I know I have explained this simplistic and have a lot to learn about
all this... the newbie toe-dipping phenomena! :-)
Regards,
GREG COCKS
Gcocks | at | stoller.com
=20
-----Original Message-----
From: TG [mailto:tg-php@gryffyndevelopment.com]=20
Sent: Thursday, March 06, 2008 9:59 PM
To: Greg Cocks; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Seeking a function, class or other means to save
the current PHP page as an HTML file on the server.
If by 'breaks' you mean that it's not saving as a .HTML file, you should
be=20
able to set the filename in the header when you force the download.
If that's not it, if you care to elaborate, maybe we can give a better=20
suggestion.
-TG
----- Original Message -----
From: "Greg Cocks"
To:
Date: Thu, 6 Mar 2008 20:40:36 -0700
Subject: RE: [PHP-WIN] Seeking a function, class or other means to save
the=20
current PHP page as an HTML file on the server.
> Thanks so much to all for the replies...
> =20
>=20
> Michael's method works work for a static page... but as the (*.php)
page
> gets data from a PostgreSQL database to display it "breaks", not
> unreasonably, when it is saved using this method as a *.html.
> =20
>=20
> Fun to learn new stuff... I am off to try and learn how I can make
this
> work, with the leads provided... :-)
> =20
>=20
> In the *meantime*, under the "Save As HTML" icon I have put some text
> letting the user know about File... Save Page As... (or ... Save
As...)
> =20
>=20
> I am going to look at maybe using this method with a PDF generation
> method to 'make' the page as a PDF for them to download...
> =20
>=20
> Thanks again... what a resource...
>=20
> Regards,
>=20
> GREG COCKS
>=20
> gcocks | at | stoller.com =20
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Seeking a function, class or other means to save the current PHP page as an HTML file on the ser
am 07.03.2008 21:32:09 von Trevor Gryffyn
So you're getting things like this in your HTML output?
Hello !
Just raw without the PHP code being interpretted?
Sounds odd.. you could try the output buffering as someone else
recommended. Or store all your HTML in a variable so it all gets
processed before you output. Or worst case scenario, try saving it all to
a temporary file, but then you have to worry about cleaning up old files.
You probably don't have to do that.
Still, if you are getting raw PHP in your output, then I think almost any of
these are going to end up with at least a raw "echo $output" type thing.
I'm guessing something else is wrong.
Let us know if you find a solution.
-TG
----- Original Message -----
From: "Greg Cocks"
To: "TG" ,
Date: Fri, 7 Mar 2008 11:52:58 -0700
Subject: RE: [PHP-WIN] Seeking a function, class or other means to save the
current PHP page as an HTML file on the server.
> Cheers TG,
>
> The query page is a form that gather the user selections, queries a
> PostgreSQL database using them, and returns some analytical data as an
> array which I serialise into a text file.
>
> The results page, the one I want to let the user save as an HTML 'file'
> is a PHP page that unserialises the data out of the array from the text
> file, and displays it in some formatted tables, one sub-table per data
> row (1 row to many hundreds) - as well as some SESSION variables, etc of
> the SQL string used to get the data (as a user reference) and the logged
> on user name & date, a list of some reference data (what the qualifers,
> etc mean) pulled directly out of the database, etc, etc.
>
> Using the File... Save Page As... method in the browser works well
> enough to save the HTML as a file/directory pair (although if you open
> separately, it looses track of the CSS file of course...)
>
> The 'breakage' is that because the results page file needs to be a PHP
> to unserialise the array, get the reference data from the database, etc,
> etc if you save it as an HTML page using the header / disposition method
> it displays all the pure HTML just fine of course - but gags on the PHP,
> thinking it is HTML...
>
> I know I have explained this simplistic and have a lot to learn about
> all this... the newbie toe-dipping phenomena! :-)
>
> Regards,
> GREG COCKS
> Gcocks | at | stoller.com
>
> -----Original Message-----
> From: TG [mailto:tg-php@gryffyndevelopment.com]
> Sent: Thursday, March 06, 2008 9:59 PM
> To: Greg Cocks; php-windows@lists.php.net
> Subject: RE: [PHP-WIN] Seeking a function, class or other means to save
> the current PHP page as an HTML file on the server.
>
>
> If by 'breaks' you mean that it's not saving as a .HTML file, you should
> be
> able to set the filename in the header when you force the download.
>
> If that's not it, if you care to elaborate, maybe we can give a better
> suggestion.
>
> -TG
>
> ----- Original Message -----
> From: "Greg Cocks"
> To:
> Date: Thu, 6 Mar 2008 20:40:36 -0700
> Subject: RE: [PHP-WIN] Seeking a function, class or other means to save
> the
> current PHP page as an HTML file on the server.
>
> > Thanks so much to all for the replies...
> >
> >
> > Michael's method works work for a static page... but as the (*.php)
> page
> > gets data from a PostgreSQL database to display it "breaks", not
> > unreasonably, when it is saved using this method as a *.html.
> >
> >
> > Fun to learn new stuff... I am off to try and learn how I can make
> this
> > work, with the leads provided... :-)
> >
> >
> > In the *meantime*, under the "Save As HTML" icon I have put some text
> > letting the user know about File... Save Page As... (or ... Save
> As...)
> >
> >
> > I am going to look at maybe using this method with a PDF generation
> > method to 'make' the page as a PDF for them to download...
> >
> >
> > Thanks again... what a resource...
> >
> > Regards,
> >
> > GREG COCKS
> >
> > gcocks | at | stoller.com
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php