Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2008, 09:44 AM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
Coding Guru needed, HELP!

I work at a local newspaper which is beginning to host news videos with their editorials. The videos are being called in with iframes, the videos are on html pages in a sub folder.

we want to begin putting commercials in the beginning of the videos

THIS IS THE TRICKY PART

We want commercial A to play on news video A on Html A, once Html "A" page has hit 1000 page loads, we would like to disable html A and begin loading html B which will play another video, once this hits 1000 page loads we would like to disable video B and load C and so forth

is there a javascript that can disable a page and load another, maybe in conjunction with an xml list.

Please keep in mind that it is all called into one iframe, wich will relay all these changes.

Please help, thanks!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #2 (permalink)  
Old 08-06-2008, 10:38 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Well, if you don't want to put the commercial into the video, or do a flash/silverlight script which automatically changes the commercial to the video, then you would need to know the exact time of the commercial.

So, what you would do is just a HTTP-META-REFRESH tag on the commercial html page.. after it hits say 30 seconds (if the commercial is 30 seconds), then it will transfer to the video.

If you are assembling this all by XML, which is good, all you need to be able to do is update the XML file with the person who hit it and keep adding the count, from there, you can determine which commercial to go to.

Not possible with Javascript to edit a file on a server, but it is rather easy with Server Side code (ASP.NET, PHP, etc)
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #3 (permalink)  
Old 08-06-2008, 11:57 AM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
actually the commercial is already rendered before the video so it's one file.

Essentially what im looking for is once html A is loaded 20 times, it disables, then we want html B to load 20 times, then disable and go to the next video and so forth.

so this would require php or asp? or can an xml simply swap this transition out?

we are trying to make this so that our online writer doesnt have to keep track of all the hits and swap it all out

thank you so much for your insight thus far!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #4 (permalink)  
Old 08-06-2008, 12:01 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Right, JavaScript cannot edit files. So, you could do this all via an XML file. You just need to write a simple script back end that will append to this XML file everytime it is reached to update the count on the commercial. So, once it hits 20, the script will see that and then tell the HTML to render the next commercial instead.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #5 (permalink)  
Old 08-06-2008, 12:08 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
oh great!

any leads to where i might be able to find something like this? which language would handle it better?

im not too well adept with server side languages.

do you know of any simple scripts?
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #6 (permalink)  
Old 08-06-2008, 01:01 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
PHP is the most lightweight for this kind of situation.

Do you know what your server operating system is? Windows or Linux?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #7 (permalink)  
Old 08-06-2008, 01:47 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
yes im on a windows back end.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #8 (permalink)  
Old 08-06-2008, 01:47 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
actually my mistake i have newfirms which is unix. i think its both windows and linux.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #9 (permalink)  
Old 08-06-2008, 01:51 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
*netfirms
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #10 (permalink)  
Old 08-06-2008, 02:02 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
So, it probably supports and has PHP compiled and running, correct?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #11 (permalink)  
Old 08-06-2008, 02:07 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
yes it does support php
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #12 (permalink)  
Old 08-06-2008, 02:36 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Okay, then you could write a simple script using the fopen and fwrite commands for XML.. or use the XML functions, whichever.

Do you need an example?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #13 (permalink)  
Old 08-06-2008, 03:16 PM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
an example would be great!

ideally this will show through an iframe on our homepage

then it would point to a sub folder of 3 html pages with 3 different videos, each will expire after 20 loads in the list

thank you so much!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #14 (permalink)  
Old 08-07-2008, 08:54 AM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
any luck izzmo?
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #15 (permalink)  
Old 08-07-2008, 09:02 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Yes, I've been working on this morning

Hopefully you have PHP 5?
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #16 (permalink)  
Old 08-07-2008, 09:32 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Thumbs up Okay

So, here is a really brief example.

What happens is everytime you access the XML file (with an id attached to it) it will update the hits on that id. So, when you want to access a video, you can pull the url down and also update the hits.

Hopefully this is what you needed!

Here is the XML file
Code:
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <items> <item name="1"> <url>http://www.yoursite.com/videos/com1.wmv</url> <hits>19</hits> </item> <item name="2"> <url>http://www.yoursite.com/videos/com2.wmv</url> <hits>1</hits> </item> <item name="3"> <url>http://www.yoursite.com/videos/com3.wmv</url> <hits>0</hits> </item> </items> </rss>
Here is the PHP file
PHP Code:
<?php
 $fid 
= (Int)$_GET["id"];
 
$element = (String)"";
 
$eid = (Int)0;
 
$xr = new XMLReader();
    
$xr->open("http://www.yoursite.com/feed.xml""UTF-8");
 
$xw = new XMLWriter();
 
$xw->openMemory();
 
$xw->startDocument("1.0""UTF-8");
 while(
$xr->read())
 {
  switch(
$xr->nodeType)
  {
   case 
XMLReader::ELEMENT:
    
$xw->startElement($xr->name);
    
$element $xr->name;
    
$element_string = (String)"";
    if(!
$xr->isEmptyElement)
     
$element_string $xr->value;
    if(
$xr->hasAttributes)
    {
     while(
$xr->moveToNextAttribute())
     {
      if(
$xr->name == "name")
       
$eid $xr->value;
      
$xw->writeAttribute($xr->name$xr->value);
     }
    }
    
$xw->text($element_string);
    break;
   case 
XMLReader::TEXT:
   
   case 
XMLReader::CDATA:
    if(
$fid == $eid && $element == "hits")
     
$xw->text($xr->value 1);
    else
     
$xw->text($xr->value);
    break;
   case 
XMLReader::SIGNIFICANT_WHITESPACE:
   case 
XMLReader::WHITESPACE:
    
$xw->text($xr->value);
    break;
   case 
XMLReader::END_ELEMENT:
    
$xw->endElement();
    break;
  }
 }
 
$xw->endDocument();
 
Header("application/xml");
 
$handle fopen("feed.xml""w");
 
fwrite($handle$xw->outputMemory(true));
 
fclose($handle);
?>
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #17 (permalink)  
Old 08-07-2008, 10:15 AM
Contributing Member
Latest Blog:
None

 
Join Date: 06-24-08
Posts: 70
iTrader: 0 / 0%
chuco61 is liked by many
WOW thank you.

Im sorry but how would i implement this? I go server side with my html iframe page, my php document and my videos. is it then working from there.

thanks again for your time and efforts!
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #18 (permalink)  
Old 08-07-2008, 12:38 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
Starting p90x today

 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,347
iTrader: 1 / 100%
Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
That's just an example, not a pure implementation for you. You would have to tweak it.

But essentially, figure out what you need to pull out from the XML sheet (and populate it before hand) and then use that script to update it.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Digg this Post!Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SEO Sales Guru Needed gridsix Services 0 05-24-2008 07:39 PM
php guru needed funguru Coding Forum 1 09-01-2006 09:41 PM
Perl - MySQL Guru Needed Zap Coding Forum 0 02-13-2006 07:14 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:23 AM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.