Re: [PHP] selfreferencing script with output
Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
- Original Message - From: Silvio Porcellana [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Sunday, September 25, 2005 12:13 AM Subject: Re: [PHP] selfreferencing script with output Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 2005-09-23 Look at the functions ob_start() and ob_flush().. Something like: ?php ob_start(); HEADER(Location: test.php); ob_flush(); ? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Sabine wrote: Thanks you very much Silvio, for your answer. Yes, it seems to be complicated. Especially regarding the time I have to do the programming for this part of my work. Now I reduced the time the preparing of the mailtext needs and hope for the moment that the servers time my script gets will be sufficient for the task. I have to check out the circumstances of the productive machine. But I will surely have a closer look on the AJAX approach later. Well yeah it sounds difficult at the beginning, but if you have time to study it a little bit this approach can be quite useful in your future projects (no_flames_pleasein some cases, in my opinion, it could be a much better solution than Flash.../no_flames_please) Anyway, thinking about your current approach I guess it would be better of you let a background process (triggered by the user input or scheduled with cron - you can use free ones on the net, like http://hostedcron.com (never used it, thou)) do the mailing: what if your user hits 'Reload' while the script is sending the emails? All the emails get re-sent? Or if it hits the 'Stop' button? Thanks again and have a nice sunday Sabine You too! ;-) Cheers Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thanks again,Gustav, I tried, but it won't work. The moment of the second headering there had been an output. So you get the error message just an iteration later. Now I reduced the time my script needs. I will check out if it has sufficient time on the productive machine. If so, it won't be necessary to do a selfreferencing script. Have a nice sunday Sabine Gustav Wiberg schrieb: - Original Message - From: Silvio Porcellana [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Sunday, September 25, 2005 12:13 AM Subject: Re: [PHP] selfreferencing script with output Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 2005-09-23 Look at the functions ob_start() and ob_flush().. Something like: ?php ob_start(); HEADER(Location: test.php); ob_flush(); ? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thanks you very much Silvio, for your answer. Yes, it seems to be complicated. Especially regarding the time I have to do the programming for this part of my work. Now I reduced the time the preparing of the mailtext needs and hope for the moment that the servers time my script gets will be sufficient for the task. I have to check out the circumstances of the productive machine. But I will surely have a closer look on the AJAX approach later. Thanks again and have a nice sunday Sabine Silvio Porcellana schrieb: Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thank you very much for your answer, Rory, but I fear I don't understand the most important parts of it. It would be very nice of you if you could give me a further hint, more explanation. Rory Browne schrieb: On 9/23/05, Sabine [EMAIL PROTECTED] wrote: Hello to all, I have 2 scripts ( preparing about 1000 mails for pear's mail-queue and sending them) which shall be started by the user. There are - limitations of the provider for the duration of the scripts - no cronjobs So I had the idea to write a selfreferencing script like that: $begin= intval($_GET[begin]); $allMails = 1000; //... prepare / send a portion of for example 50 mails if (($begin+ 50) $allMails) { header(Location: script.php?begin=.($begin+ 50)); } else { echo Done!; } But I want to show the user some output like a statusbar (eventually with pear's Html_Progress) or something like that so he knows the script is still working. instead of simply headering the location out, you could simply output a html page, that has a meta tag to replace it. What do you mean with that meta tag? maybe something like html/head/meta tag here body ?php $full_width = 200; $amt_sent = $_GET['begin'] + 50; $amt_to_send = 1000; $img_width = ceil($amt_sent * $full_width / $amt_to_send); ? img src=pixel.php height=20 width=?php echo $img_width; ? ?php flush(); send_the_mails(); ? Has anybody of you an idea, a tip for me how to do it? I don't see how I can do it within the construct above. Is there an alternative to it? This doesn't necessarly need to be done using a self-referencing script. You could have an ajax type system where each script is accessed sequentially. And what is an ajax type system? I'm not sure if I don't understand what you mean due to my lack of english speaking capabilities or if I don't know the concept. I assume the last. But additionaly I don't find the word ajax in my dictionaries or at leo's. Is it an abbreviation? Kind regards Sabine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Gustav Wiberg schrieb: - Original Message - From: Sabine [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Friday, September 23, 2005 6:14 PM Subject: [PHP] selfreferencing script with output Hello to all, I have 2 scripts ( preparing about 1000 mails for pear's mail-queue and sending them) which shall be started by the user. There are - limitations of the provider for the duration of the scripts - no cronjobs So I had the idea to write a selfreferencing script like that: $begin= intval($_GET[begin]); $allMails = 1000; //... prepare / send a portion of for example 50 mails if (($begin+ 50) $allMails) { header(Location: script.php?begin=.($begin+ 50)); } else { echo Done!; } But I want to show the user some output like a statusbar (eventually with pear's Html_Progress) or something like that so he knows the script is still working. Has anybody of you an idea, a tip for me how to do it? I don't see how I can do it within the construct above. Is there an alternative to it? Thanks in advance for your answers Sabine Hi I don't know if this works, but I think it ought to work: Set a picture (a line) with width 1, next iteration set the line to width 2, next to width 3... OR set a picture with width % off count of mails Change picture with dhtml (or if you prefer Javascript and css ;-)) /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.5/110 - Release Date: 2005-09-22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] selfreferencing script with output
Hello to all, I have 2 scripts ( preparing about 1000 mails for pear's mail-queue and sending them) which shall be started by the user. There are - limitations of the provider for the duration of the scripts - no cronjobs So I had the idea to write a selfreferencing script like that: $begin= intval($_GET[begin]); $allMails = 1000; //... prepare / send a portion of for example 50 mails if (($begin+ 50) $allMails) { header(Location: script.php?begin=.($begin+ 50)); } else { echo Done!; } But I want to show the user some output like a statusbar (eventually with pear's Html_Progress) or something like that so he knows the script is still working. Has anybody of you an idea, a tip for me how to do it? I don't see how I can do it within the construct above. Is there an alternative to it? Thanks in advance for your answers Sabine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
On 9/23/05, Sabine [EMAIL PROTECTED] wrote: Hello to all, I have 2 scripts ( preparing about 1000 mails for pear's mail-queue and sending them) which shall be started by the user. There are - limitations of the provider for the duration of the scripts - no cronjobs So I had the idea to write a selfreferencing script like that: $begin= intval($_GET[begin]); $allMails = 1000; //... prepare / send a portion of for example 50 mails if (($begin+ 50) $allMails) { header(Location: script.php?begin=.($begin+ 50)); } else { echo Done!; } But I want to show the user some output like a statusbar (eventually with pear's Html_Progress) or something like that so he knows the script is still working. instead of simply headering the location out, you could simply output a html page, that has a meta tag to replace it. maybe something like html/head/meta tag here body ?php $full_width = 200; $amt_sent = $_GET['begin'] + 50; $amt_to_send = 1000; $img_width = ceil($amt_sent * $full_width / $amt_to_send); ? img src=pixel.php height=20 width=?php echo $img_width; ? ?php flush(); send_the_mails(); ? Has anybody of you an idea, a tip for me how to do it? I don't see how I can do it within the construct above. Is there an alternative to it? This doesn't necessarly need to be done using a self-referencing script. You could have an ajax type system where each script is accessed sequentially. Thanks in advance for your answers Sabine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
- Original Message - From: Sabine [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Friday, September 23, 2005 6:14 PM Subject: [PHP] selfreferencing script with output Hello to all, I have 2 scripts ( preparing about 1000 mails for pear's mail-queue and sending them) which shall be started by the user. There are - limitations of the provider for the duration of the scripts - no cronjobs So I had the idea to write a selfreferencing script like that: $begin= intval($_GET[begin]); $allMails = 1000; //... prepare / send a portion of for example 50 mails if (($begin+ 50) $allMails) { header(Location: script.php?begin=.($begin+ 50)); } else { echo Done!; } But I want to show the user some output like a statusbar (eventually with pear's Html_Progress) or something like that so he knows the script is still working. Has anybody of you an idea, a tip for me how to do it? I don't see how I can do it within the construct above. Is there an alternative to it? Thanks in advance for your answers Sabine Hi I don't know if this works, but I think it ought to work: Set a picture (a line) with width 1, next iteration set the line to width 2, next to width 3... OR set a picture with width % off count of mails Change picture with dhtml (or if you prefer Javascript and css ;-)) /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.5/110 - Release Date: 2005-09-22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php