Re: [PHP] Updating HTML on page

2010-04-06 Thread tedd

At 8:12 PM -0600 4/5/10, Ashley M. Kirchner wrote:

I have a PHP script that queries a DB to get a list of image names.  Then it
processes each name and generate thumbnails and what not.  What I want to do
is have a page called (through the browser) which updates as the PHP process
in the background is working.  So when you first pull up the page it will
say 'There are x images to process' and then dynamically update the page
with a progress status.  In its crudest form it should say something like
'Processing 1 of 5 images .'  When that image is done, it should update the
page with 2 of 5 . etc., etc.  Ideally without refreshing the page each
time.



Is this where I need to figure out Ajax and incorporate it with PHP?


Exactly.

Here's an example:

http://webbytedd.com/b/timed-php/

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Updating HTML on page

2010-04-05 Thread Paul M Foster
On Mon, Apr 05, 2010 at 09:29:26PM -0600, Ashley M. Kirchner wrote:

> Hrm, been looking at it for a while now and I can feel a headache coming up.
> I think I need to have one PHP script that does the processing, and another
> that the user pulls up in their browser.  That one "pings" the processor
> every so often to get updated data.  Yes?
> 
> Am I way off here?

Slightly. PHP code runs on the server, so in the browser, it won't
"ping" the server.

Yes, you should have a PHP script on the server to do the processing,
(call it, say, "process.php") and one which paints the basic screen for
the browser (call it "page.php" or somesuch). But the connection between
these should be AJAX code in the page.php script. That will most likely
be Javascript in the page.php script which will "ping" the process.php
script for whatever contents you want.

The Javascript to do this is beyond the scope of this list (it's a PHP
list, after all). The "process" script doesn't have to be PHP. It could
be any language you prefer, as long as you can get it to return JSON or
XML to page.php, so that the Javascript in the page.php script can
interpret it.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Updating HTML on page

2010-04-05 Thread Ashley M. Kirchner
Hrm, been looking at it for a while now and I can feel a headache coming up.
I think I need to have one PHP script that does the processing, and another
that the user pulls up in their browser.  That one "pings" the processor
every so often to get updated data.  Yes?

Am I way off here?

> -Original Message-
> From: TG [mailto:tg-...@gryffyndevelopment.com]
> Sent: Monday, April 05, 2010 8:48 PM
> To: Ashley M. Kirchner; php-general@lists.php.net
> Subject: Re: [PHP] Updating HTML on page
> 
> The only way to do it with PHP alone would be to control the output
> buffering and I've found that to be inconsistant in quality and
> predictability with different browsers even web servers.  I'm sure
> there's an art to getting that all working well with various
> technologies
> that are involved in the script -> client caching and processing, but
> why
> mess with iffy when you can use a proven technology like AJAX.
> 
> Get familiar with jQuery (or one of the other big JS libraries, but
> jQuery
> is my choice hands-down) and you'll probably find it's pretty easy.
> 
> -TG


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Updating HTML on page

2010-04-05 Thread TG
The only way to do it with PHP alone would be to control the output 
buffering and I've found that to be inconsistant in quality and 
predictability with different browsers even web servers.  I'm sure 
there's an art to getting that all working well with various technologies 
that are involved in the script -> client caching and processing, but why 
mess with iffy when you can use a proven technology like AJAX.

Get familiar with jQuery (or one of the other big JS libraries, but jQuery 
is my choice hands-down) and you'll probably find it's pretty easy.

-TG

- Original Message -
From: "Ashley M. Kirchner" 
To: 
Date: Mon, 5 Apr 2010 20:12:30 -0600
Subject: [PHP] Updating HTML on page

> I have a PHP script that queries a DB to get a list of image names.  Then 
it
> processes each name and generate thumbnails and what not.  What I want to 
do
> is have a page called (through the browser) which updates as the PHP 
process
> in the background is working.  So when you first pull up the page it will
> say 'There are x images to process' and then dynamically update the page
> with a progress status.  In its crudest form it should say something like
> 'Processing 1 of 5 images .'  When that image is done, it should update 
the
> page with 2 of 5 . etc., etc.  Ideally without refreshing the page each
> time.
> 
>  
> 
> Is this where I need to figure out Ajax and incorporate it with PHP?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Updating HTML on page

2010-04-05 Thread Ashley M. Kirchner
I have a PHP script that queries a DB to get a list of image names.  Then it
processes each name and generate thumbnails and what not.  What I want to do
is have a page called (through the browser) which updates as the PHP process
in the background is working.  So when you first pull up the page it will
say 'There are x images to process' and then dynamically update the page
with a progress status.  In its crudest form it should say something like
'Processing 1 of 5 images .'  When that image is done, it should update the
page with 2 of 5 . etc., etc.  Ideally without refreshing the page each
time.

 

Is this where I need to figure out Ajax and incorporate it with PHP?