This is a discussion on Output to another window within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'm new to php and was wondering if the following was possible... I would like to have a list ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm new to php and was wondering if the following was possible...
I would like to have a list of items loaded from a text file, process each item in the list and then return the processed result to a new window so that the new window displays the results, one by one, until it is done processing the list. I considered javascript but the whole client-side/server-side divide seems difficult for this newbie to figure out. Is what I want possible? |
|
|||
|
"astromac" <obearsstate@gmail.com> wrote in message news:1138811873.863948.221040@o13g2000cwo.googlegr oups.com... > I'm new to php and was wondering if the following was possible... > > I would like to have a list of items loaded from a text file, process > each item in the list and then return the processed result to a new > window so that the new window displays the results, one by one, until > it is done processing the list. > > I considered javascript but the whole client-side/server-side divide > seems difficult for this newbie to figure out. Is what I want possible? > this is mostly a javascript problem. your PHP will write sequences of javascript which concatenate strings (or just create one big one). note that disabled users may not necessarily have javascript on their machine. <script language="javascript"> var page = "<html><head><title>one sub window</title></head>"; page += "<body><h1>this window is new.</h1></body></html>"; var w = window.open("","NewWindow","toolbar,status,resizea ble,location,scrollbars,menubar"); if (null != w) { w.document.write(s); } else { document.write("your popup blocker needs to be disabled."); } </script> in PHP, readfile() will simply dump a file's contents to the browser. if it has line breaks in it, you can't use it for making javascript strings. you must process the file from PHP. use fopen, fread, and fclose. with fread you must specify the number of bytes to read, so you might as well make it something like 8192. or make it big enough to read the entire file in at once, then strip out or process the \n linebreaks. maybe explode on them and output the resulting array. I am not sure exactly what you are trying to do, but I hope this helps. |