Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

background process in php

Posted on 2004-10-13
4
Medium Priority
?
243 Views
Last Modified: 2006-11-17
Hello,   I have a screen that will be displaying a movie created for windows media player.  While this movie is running I need javascript to kick off a  background process to update the movie.  This could happen several times while the movie is running.  Can I write the background process in php?  will it popup a little window or can I write it completely in the background (preferable).  If I can not write it that way can I integrate a java file into the mix?  Lots of stuff to this question so I appreciate the help!
0
Comment
Question by:JGoyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 12299019
What do you mean by "update the movie"? And why would this process happen frequently?

As you use javascript it is never a problem to call a php script in the background. It is just the question what it is you need the php script to do and how you want it to output its data.

There are a lot of ways:
- use process.php?ext=.png, let the script first return a png and then have it do some maintainance processing.
- use a iframe and call the script in there.
- let javascript add a <script src="somephp.php"></script> to the document contents and let the script return javascript output.

Please give us more details as to what it is you need.

-r-
0
 
LVL 2

Author Comment

by:JGoyer
ID: 12299176
More details:  The movie is to seperated out into multiple modules.  The viewer has the option of watching it in its entirety or stopping at somepoint.  We need to keep track of which modules they have completed so that when they come back to the movie they can go right back to where they were.  So, once they reach the end of module 1 javascript kicks off a call to a php process (how does it do that?) that process runs in a seperate window (output something like you have finished module one continue to module 2?) if they click yes the javascript window goes away and the next module starts up, if they click no they go to another screen.  The part about going on to the next mod in the same screen is pretty key also.  Thanks for you time and whatever you can come up with in this mess ;-)

JGoyer

ps what is an iframe?
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 2000 total points
ID: 12299417
An iframe is inline frame. And can be used to display another website into a rectangular display on a place you would like it to display.

Personally, I don't know how javascript is going to detect when the moviepart is stopped. But from that point on, it would be quite 'easy'. You would write a function in javascript like the one i'll write below:

<script type="text/javascript">
function run_php_window(currentmovieid)
{
    window.open('continue.php?movieid=' + currentmovieid, 'continueWindow', 'height=240,width=320');
}
</script>

Continue.php would then look something like this:
stage 1 is the stage where the visitor gets asked wether or not he would like to continue.
stage 2 is the stage where we will redirect the parent window.
<?php

$movieid = $_GET['movieid'];
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
 $stage = 2;
}
else
{
 $stage = 1;
}

if($stage == 1)
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'].'?movieid='.$movieid;?>">
<input type="submit" name="movie_next" value="Goto next module" />
<input type="submit" name="movie_stop" value="Call it a day" />
</form>
<?php
}
elseif($stage == 2)
{
 if(isset($_POST['movie_next']))
   $parenturl = 'url_of_next_module';
 else
   $parenturl = 'url_of_the_other_screen';
 ?>
 <html>
  <head>
   <title>Handling your request</title>
   <script type="text/javascript">
   function go()
   {
    window.opener.location.href="<?php echo $parenturl;?>";
    window.close();
   }
   </script>
  </head>
  <body onload="go();">
    You request will be handled appropriately. You will be directed to:
    <p><a target="_blank" href="<?php echo $parenturl;?>"><?php echo $parenturl;?></a>.</p>
    If redirection fails. Please click the link above and close this window.
  </body>
  </html>
<?php  
}
?>

This would give you a popup window asking what people want to do and then handling accordingly.

Regards

-r-
0
 
LVL 2

Author Comment

by:JGoyer
ID: 12322584
Thanks a ton!!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question