Jump to content

businessman332211@hotmail.com

Members
  • Posts

    304
  • Joined

  • Last visited

Everything posted by businessman332211@hotmail.com

  1. This specifically is probably a function call and not a variable.
  2. I see what it output's yes. i understand that part, it's just I am tellign the start handler to find the range that is current. When it find's a match it tell's me what is going on. However if I go to data, I still don't understand how to make it do something like get the data, or something else, when a match is found in the first function.
  3. I more of mean, I just don't understand the process. Right now I have the start element echoing got you when a match is found. If I try echoing the data there, in the other, it doesn't echo. <?php$time = strftime("%Y%m%d%H%M%S%");function startElement($parser, $name, $att='') { global $time; global $open_tags; global $current_tag; $current_tag = $name; $start = strftime($att['START']); $stop = strftime($att['STOP']); if ($start < $time && $stop > $time) { } if ($format = $open_tags[$name]){ switch($name){ case 'PROGRAMME': break; } }}?> The function above is where I am testing it at, it find's it appropriately if possible. It prints got you to the screen, so I know it found a match. If I then try to echo data down there, it doesn't echo the data.Nothing seems to be working, I tried making the stop start, and attributes global, then doing the same calculations for date. I am a little confused on what is next. I have also tried echoing out the data in that function it come's up blank. I am a little confused, if I just echo out the data in the data handler function it echo's out all the data in between all tags. I don't understand what it's doing.
  4. <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searching$time = strftime("%Y%m%d%H%M%S%");function startElement($parser, $name, $att='') { global $time; global $open_tags; global $current_tag; $current_tag = $name; $start = strftime($att['START']); $stop = strftime($att['STOP']); if ($start < $time && $stop > $time) { echo "Got you"; } if ($format = $open_tags[$name]){ switch($name){ case 'PROGRAMME': break; } }}// function to end searchingfunction endElement($parser, $name, $attrs='') { global $close_tags; if ($format = $close_tags[$name]){ switch($name){ case 'PROGRAMME': $a = "1"; break; } }}// function to take data from tagsfunction tagData($parser, $data) { switch($current_tag){ case 'PROGRAMME': break; }}// set variables (tags)$open_tags = array("programme" => "<programme>", "title" => "<title>", "sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>", "title" => "</title>", "sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach xml_parser_free($parser);?> Perfect, that step is completed. Thanks. There are 2 more things I need to figure out, the last one I should be able to handle.Now that I have this working (thanks to you), how do I get it to recognice the title/subtitle/time of the current playing show.Now, I am having this problem, when I put it here, it says got you, when I put it inside the switch for programme, nothing. I need to figure out how to specify by start and stop, which program it's on, so I can capture the start time, stop time, title, and subtitle all inside an array. That is the next step, any guidance is appreciated, or pointing me in the right direction. Thanks.
  5. <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searching$time = strftime("%Y%m%d%H%M");function startElement($parser, $name, $att='') { global $open_tags; global $current_tag; $current_tag = $name; if ($att['START'] < $time && $att['STOP'] > $time) { echo "Got you"; } if ($format = $open_tags[$name]){ switch($name){ case 'PROGRAMME': break; } }}// function to end searchingfunction endElement($parser, $name, $attrs='') { global $close_tags; if ($format = $close_tags[$name]){ switch($name){ case 'PROGRAMME': $a = "1"; break; } }}// function to take data from tagsfunction tagData($parser, $data) { switch($current_tag){ case 'PROGRAMME': break; }}// set variables (tags)$open_tags = array("programme" => "<programme>", "title" => "<title>", "sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>", "title" => "</title>", "sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach xml_parser_free($parser);?> Ok, I have done massive amounts of more studying last night, then came today, made some corrections, fixes, and tried out some of what you said.Yes the attribute is saved in that array, so I can access them via $att['START']$att['STOP']I can get access to them using this method.Now, I have created the above code, but it still is not working. I am simply trying to identify the location of the start time, and start time so I can know I can find it, then from there, find out how to get the title/subtitle of what was currently playing, and save it in an array. However it's not returning anything, I know the currently playing programme is in each xml file, it's not telling me after checking through this xml file, that one of them is now playing, again below is an example of the entire xml file (They are all the same, but in this case, I am putting the one I am actively working with.Any advice would be greatly appreciated. <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE tv SYSTEM "xmltv.dtd"><tv source-info-url="http://labs.zap2it.com/" source-info-name="TMS Data Direct Service" generator-info-name="XMLTV" generator-info-url="http://www.xmltv.org/"> <channel id="I10021.labs.zap2it.com"> <display-name>29 AMC</display-name> <display-name>29 AMC GA60311:-</display-name> <display-name>29</display-name> <display-name>AMC</display-name> <display-name>AMC</display-name> <display-name>Satellite</display-name> </channel> <programme start="20070201000000 -0500" stop="20070201023000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">The Exorcist</title> <desc lang="en">An actress (Ellen Burstyn) calls upon Jesuits to try to end her 12-year-old daughter's (Linda Blair) possession by the devil.</desc> <credits> <director>William Friedkin</director> <actor>Ellen Burstyn</actor> <actor>Linda Blair</actor> <actor>Max von Sydow</actor> <actor>Lee J. Cobb</actor> <actor>Kitty Winn</actor> <actor>Jack MacGowran</actor> <actor>Jason Miller</actor> <actor>Reverend William O'Malley</actor> <actor>Barton Heyman</actor> <actor>Pete Masterson</actor> <actor>Rudolf Schundler</actor> <actor>Gina Petrushka</actor> <actor>Robert Symonds</actor> <actor>Arthur Storch</actor> <actor>Reverend Thomas Bermingham</actor> <actor>Vasiliki Maliaros</actor> <actor>Tito Vandis</actor> <actor>Wallace Rooney</actor> <actor>Ron Faber</actor> <actor>Donna Mitchell</actor> <producer>William Peter Blatty</producer> </credits> <date>1973</date> <category lang="en">Horror</category> <length units="minutes">122</length> <episode-num system="dd_progid">MV011397.0000</episode-num> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-14</value> </rating> <rating system="advisory"> <value>Adult Situations</value> </rating> <rating system="advisory"> <value>Language</value> </rating> <rating system="advisory"> <value>Graphic Violence</value> </rating> <rating system="MPAA"> <value>R</value> </rating> <star-rating> <value>4/4</value> </star-rating> </programme> <programme start="20070201023000 -0500" stop="20070201043000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Halloween 5: The Revenge of Michael Meyers</title> <desc lang="en">Dr. Loomis (Donald Pleasence) meets Mike's 9-year-old niece (Danielle Harris), who seems to know when he's going to kill next.</desc> <credits> <director>Dominique Othenin-Girard</director> <actor>Donald Pleasence</actor> <actor>Danielle Harris</actor> <actor>Wendy Kaplan</actor> <actor>Ellie Cornell</actor> <actor>Donald L. Shanks</actor> <actor>Jeffrey Landman</actor> <actor>Beau Starr</actor> <actor>Betty Carvalho</actor> <actor>Tamara Glynn</actor> <producer>Ramsey Thomas</producer> </credits> <date>1989</date> <category lang="en">Horror</category> <length units="minutes">96</length> <episode-num system="dd_progid">MV028011.0000</episode-num> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-14</value> </rating> <rating system="advisory"> <value>Adult Situations</value> </rating> <rating system="advisory"> <value>Language</value> </rating> <rating system="advisory"> <value>Nudity</value> </rating> <rating system="advisory"> <value>Violence</value> </rating> <rating system="MPAA"> <value>R</value> </rating> <star-rating> <value>2/4</value> </star-rating> </programme> <programme start="20070201043000 -0500" stop="20070201053000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Backstory</title> <sub-title lang="en">Halloween</sub-title> <desc lang="en">Interviews with director John Carpenter and stars Jamie Lee Curtis and P.J. Soles highlight this look at the production and success of "Halloween."</desc> <date>20021026</date> <category lang="en">Documentary</category> <category lang="en">Entertainment</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP366911.0052</episode-num> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-G</value> </rating> </programme> <programme start="20070201053000 -0500" stop="20070201060000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Movies 101</title> <sub-title lang="en">Jennifer Connelly</sub-title> <desc lang="en">Jennifer Connelly.</desc> <date>20051209</date> <category lang="en">Entertainment</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP769058.0010</episode-num> <episode-num system="onscreen">108</episode-num> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-PG</value> </rating> </programme> <programme start="20070201060000 -0500" stop="20070201083000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Emperor of the North</title> <desc lang="en">Two 1930s hobos (Lee Marvin, Keith Carradine) try to ride a brutal conductor's (Ernest Borgnine) freight train.</desc> <credits> <director>Robert Aldrich</director> <actor>Lee Marvin</actor> <actor>Ernest Borgnine</actor> <actor>Keith Carradine</actor> <actor>Charles Tyner</actor> <actor>Harry Caesar</actor> <actor>Malcolm Atterbury</actor> <actor>Simon Oakland</actor> <actor>Matt Clark</actor> <actor>Elisha Cook Jr.</actor> </credits> <date>1973</date> <category lang="en">Adventure</category> <length units="minutes">118</length> <episode-num system="dd_progid">MV002416.0000</episode-num> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="advisory"> <value>Violence</value> </rating> <rating system="MPAA"> <value>PG</value> </rating> <star-rating> <value>2.5/4</value> </star-rating> </programme> <programme start="20070201083000 -0500" stop="20070201101500 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Battle at Bloody Beach</title> <desc lang="en">A U.S. civilian (Audie Murphy) supplies Filipino guerrillas with weapons while looking for his lost wife (Dolores Michaels) in Manila.</desc> <credits> <director>Herbert Coleman</director> <actor>Audie Murphy</actor> <actor>Gary Crosby</actor> <actor>Dolores Michaels</actor> <actor>Alejandro Rey</actor> <actor>Marjorie Stapp</actor> <actor>Barry Atwater</actor> <actor>E.J. Andre</actor> <actor>Dale Ishimoto</actor> <actor>Lillian Bronson</actor> <actor>Miriam Colón</actor> <actor>Pilar Seurat</actor> <actor>William Mims</actor> <actor>Ivan Dixon</actor> <actor>Kevin Brodie</actor> <actor>Sara Anderson</actor> <actor>Lloyd Kino</actor> <producer>Richard Maibaum</producer> </credits> <date>1961</date> <category lang="en">War</category> <length units="minutes">83</length> <episode-num system="dd_progid">MV018984.0000</episode-num> <video> <colour>no</colour> </video> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="advisory"> <value>Violence</value> </rating> <rating system="MPAA"> <value>NR</value> </rating> <star-rating> <value>2.5/4</value> </star-rating> </programme> <programme start="20070201101500 -0500" stop="20070201121500 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">The Desert Fox: The Story of Rommel</title> <desc lang="en">Field Marshal Rommel (James Mason) leads his tanks and joins a doctor's (Cedric Hardwicke) plot to kill Hitler.</desc> <credits> <director>Henry Hathaway</director> <actor>James Mason</actor> <actor>Cedric Hardwicke</actor> <actor>Jessica Tandy</actor> </credits> <date>1951</date> <category lang="en">War</category> <length units="minutes">88</length> <episode-num system="dd_progid">MV131031.0000</episode-num> <video> <colour>no</colour> </video> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="MPAA"> <value>NR</value> </rating> <star-rating> <value>3/4</value> </star-rating> </programme> <programme start="20070201121500 -0500" stop="20070201141500 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Sink the Bismarck!</title> <desc lang="en">A British captain (Kenneth More) and his Wren aide (Dana Wynter) lead the 1941 pursuit of the sinister German battleship.</desc> <credits> <director>Lewis Gilbert</director> <actor>Kenneth More</actor> <actor>Dana Wynter</actor> <actor>Carl Mohner</actor> <actor>Laurence Naismith</actor> <actor>Geoffrey Keen</actor> <actor>Karel Stepanek</actor> <actor>Michael Hordern</actor> <actor>Maurice Denham</actor> <actor>Michael Goodliffe</actor> <actor>Edmund Knight</actor> <actor>Jack Watling</actor> <actor>Mark Dignam</actor> <actor>Ernest Clark</actor> <actor>John Horsley</actor> <actor>Peter Burton</actor> <actor>John Stuart</actor> <actor>Walter Hudd</actor> <actor>Sidney Tafler</actor> <producer>John Brabourne</producer> </credits> <date>1960</date> <category lang="en">War</category> <length units="minutes">98</length> <episode-num system="dd_progid">MV007286.0000</episode-num> <video> <colour>no</colour> </video> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="MPAA"> <value>NR</value> </rating> <star-rating> <value>3/4</value> </star-rating> </programme> <programme start="20070201141500 -0500" stop="20070201170000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Twelve O'Clock High</title> <desc lang="en">An adjutant (Dean Jagger) provides support for an Allied flight commander (Gary Merrill) and the latter's successor (Gregory Peck) who have to run daylight bombing raids out of England.</desc> <credits> <director>Henry King</director> <actor>Gregory Peck</actor> <actor>Dean Jagger</actor> <actor>Gary Merrill</actor> <actor>Hugh Marlowe</actor> <actor>Millard Mitchell</actor> <actor>Robert Arthur</actor> <actor>Paul Stewart</actor> <actor>John Kellogg</actor> <actor>Robert Patten</actor> <actor>Lee MacGregor</actor> <producer>Darryl F. Zanuck</producer> </credits> <date>1949</date> <category lang="en">War</category> <length units="minutes">132</length> <episode-num system="dd_progid">MV000166.0000</episode-num> <video> <colour>no</colour> </video> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="MPAA"> <value>NR</value> </rating> <star-rating> <value>4/4</value> </star-rating> </programme> <programme start="20070201170000 -0500" stop="20070201200000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">The Green Berets</title> <desc lang="en">A cynical newsman (David Janssen) follows a Green Beret colonel (John Wayne) on missions to hold a hill and kidnap a Viet Cong general.</desc> <credits> <director>John Wayne</director> <director>Ray Kellogg</director> <actor>John Wayne</actor> <actor>David Janssen</actor> <actor>Jim Hutton</actor> <actor>Aldo Ray</actor> <actor>Raymond St. Jacques</actor> <actor>Bruce Cabot</actor> <actor>Jack Soo</actor> <actor>George Takei</actor> <actor>Patrick Wayne</actor> <actor>Luke Askew</actor> <actor>Irene Tsu</actor> <actor>Edward Faulkner</actor> <actor>Jason Evers</actor> <actor>Mike Henry</actor> <actor>Richard Pryor</actor> <producer>Michael Wayne</producer> </credits> <date>1968</date> <category lang="en">War</category> <length units="minutes">141</length> <episode-num system="dd_progid">MV001125.0000</episode-num> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="MPAA"> <value>G</value> </rating> <star-rating> <value>2/4</value> </star-rating> </programme> <programme start="20070201200000 -0500" stop="20070201223000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">Hellfighters</title> <desc lang="en">An oil-rig firefighter's (John Wayne) estranged daughter (Katharine Ross) falls in love with his right-hand man (Jim Hutton).</desc> <credits> <director>Andrew V. McLaglen</director> <actor>John Wayne</actor> <actor>Katharine Ross</actor> <actor>Jim Hutton</actor> <actor>Vera Miles</actor> <actor>Jay C. Flippen</actor> <actor>Bruce Cabot</actor> <actor>Ed Faulkner</actor> <actor>Barbara Stuart</actor> <actor>Edmund Hashim</actor> <actor>Valentin De Vargas</actor> <actor>Frances Fong</actor> <actor>Alberto Morin</actor> <actor>Alan Caillou</actor> <actor>Laraine Stephens</actor> <actor>John Alderson</actor> <actor>Lal Chand Mehra</actor> <actor>Rudy Diaz</actor> <actor>Bebe Louie</actor> <actor>Pedro Gonzalez-Gonzalez</actor> <actor>Edward Colmans</actor> <producer>Robert Arthur</producer> </credits> <date>1968</date> <category lang="en">Adventure</category> <length units="minutes">121</length> <episode-num system="dd_progid">MV005620.0000</episode-num> <subtitles type="teletext" /> <rating system="VCHIP"> <value>TV-PG</value> </rating> <rating system="MPAA"> <value>G</value> </rating> <star-rating> <value>2/4</value> </star-rating> </programme> <programme start="20070201223000 -0500" stop="20070202010000 -0500" channel="I10021.labs.zap2it.com"> <title lang="en">McQ</title> <desc lang="en">A Seattle detective (John Wayne) quits the force and exposes a drug ring with ties to the police.</desc> <credits> <director>John Sturges</director> <actor>John Wayne</actor> <actor>Eddie Albert</actor> <actor>Diana Muldaur</actor> <actor>Colleen Dewhurst</actor> <actor>Clu Gulager</actor> <actor>David Huddleston</actor> <actor>Al Lettieri</actor> <actor>Julie Adams</actor> <actor>Jim Watkins</actor> <actor>Roger E. Mosley</actor> <actor>William Bryant</actor> <actor>Joe Tornatore</actor> <actor>Richard Kelton</actor> <actor>Richard Eastham</actor> <actor>###### Friel</actor> <producer>Jules Levy</producer> <producer>Arthur Gardner</producer> <producer>Lawrence Roman</producer> </credits> <date>1974</date> <category lang="en">Crime drama</category> <length units="minutes">112</length> <episode-num system="dd_progid">MV003088.0000</episode-num> <rating system="VCHIP"> <value>TV-14</value> </rating> <rating system="advisory"> <value>Violence</value> </rating> <rating system="MPAA"> <value>PG</value> </rating> <star-rating> <value>2/4</value> </star-rating> </programme></tv>
  6. Ok, based on what you said I am goign to study some more tonight.Tomorrow I will try to pull all this together in my program, maybe you can help me out again if I get stuck, I knew I could count on you, everytime I have really needed help you were there to give me guidance.Thanks so far, for the help, let me soak some of this in, and put together what I can.
  7. Ok, here is my full program right now. <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction startElement($parser, $name, $attrs='') { global $open_tags; $current_tag = $name; if ($format = $open_tags[$name]){ switch($name){ case 'programme': $a = "0"; break; default: break; } }}// function to end searchingfunction endElement($parser, $name, $attrs='') { global $close_tags; if ($format = $close_tags[$name]){ switch($name){ case 'programme': $a = "1"; break; } }}// function to take data from tagsfunction tagData($parser, $data) { global $current_tagswitch($current_tag){ case 'programme': echo('<h1>This is the article</h1>'); break; }}}// set variables (tags)$open_tags = array("programme" => "<programme>", "title" => "<title>", "sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>", "title" => "</title>", "sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach ?> Ok, the top 2 arrays aren't being used yet. I need to later be able to run through all xml file's and save the currently playing program into an array. For now I just want to do one xml file, to get the currently playing program from that file, so I can then replicate it to get the other's.In this programming code above, $current_tag = $name is used later on to tell the data handling function which tag it's talking about. SInce it run's through them, trapping that in a variable, then later tells the other function, we are working with data in between those 2 tag's.THat is what I formulated based on the tutorials.As for format, I am not sure, just something else I got together using the tutorials. I just still don't udnerstand how the whole thing works. The 2 questions I haveIs where to do the calculations, do I just put it in between what i currently have like this function startElement($parser, $name, $attrs){ global $open_tags; $current_tag = $name; //this variable doesn't get used anywhere else if ($format = $open_tags[$name]) //why are you using $format? what is the purpose of this if statement? { switch($name) { case 'programme': $a = "0"; echo "attribute list for programme:<br>"; foreach ($attrs as $a_name => $a_val) { // do date calculations, on the start time and start date. // which in this context, should be saved in a_name as start and stop I guess // see that is the part I don't understand. } break; default: break; } }} What is bad, is I need to replciate this code after I start pulling the now playing, and then setup a foreach so it will do it for each xml file. This is getting really deep, that is why I needed some expertise, but it's hard finding someone willing to lend a hand with something related to xml parsing, everyone i tried knew nothing about it, and the one's that did, didn't feel like explaining anything. I am slowing hacking away at it, day by day. After studying xml/php parsing all weekend, I finally made some progress on monday, each day I get a little further and understand a little more, but this whole Expat library is hard to come to grip's with.Thanks for any feedback.
  8. That code there probably doesn't work fully, I made some changes to it, when I change it back, the data is the data in between the tag's.What it does is run through the xml until it get's to the first open element, it runs the open function, then it takes care of finding the ending element, and loads the ending funciton, then loads the data function to handle data in between. starts at the next element and cycles through them again, I know how to feed it end tag's, start tag's, how to get the data. However I don't know how to factor in attributes, or how to format them when I put them in.
  9. // Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction startElement($parser, $name, $attrs='') {global $open_tags;$current_tag = $name;if ($format = $open_tags[$name]){switch($name){case 'programme':$a = "0";break;default:break;}}}// function to end searchingfunction endElement($parser, $name, $attrs='') {global $close_tags;if ($format = $close_tags[$name]){switch($name){case 'programme':$a = "1";break;}}}// function to take data from tagsfunction tagData($parser, $data) {global $current_tagswitch($current_tag){case 'programme':echo('<h1>This is the article</h1>');break;case 'articleName':echo('<h2>'.$data.'</h2>');break;case 'author':echo('<h3>By: '.$data.'</h3>');break;case 'date':echo('<h3>On: '.$data.'</h3>');break;case 'articleBody':echo('<p>On: '.$data.'</p>');break;}}}// set variables (tags)$open_tags = array("programme" => "<programme>","title" => "<title>","sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>","title" => "</title>","sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData"); These are the things I don't understand1. How to work with the attributes.I found some good tutorials on this before, but now, I have run out of possible tutorial's, it's making it pretty hard.
  10. THANK YOU, I have been trying to get help on this forever. I know somebody would pay attention to me. Yes there is something I need to figure out, I have the whole script done up to a point.Here is my current code.Based on the layout of the xml file's shown aboveHere is my current program <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction startElement($parser, $name, $attrs='') { global $open_tags; $current_tag = $name; if ($format = $open_tags[$name]){ switch($name){ case 'programme': $a = "0"; break; default: break; } }}// function to end searchingfunction endElement($parser, $name, $attrs='') { global $close_tags; if ($format = $close_tags[$name]){ switch($name){ case 'programme': $a = "1"; break; } }}// function to take data from tagsfunction tagData($parser, $data) { global $current_tagswitch($current_tag){ case 'programme': echo('<h1>This is the article</h1>'); break; case 'articleName': echo('<h2>'.$data.'</h2>'); break; case 'author': echo('<h3>By: '.$data.'</h3>'); break; case 'date': echo('<h3>On: '.$data.'</h3>'); break; case 'articleBody': echo('<p>On: '.$data.'</p>'); break; }}}// set variables (tags)$open_tags = array("programme" => "<programme>", "title" => "<title>", "sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>", "title" => "</title>", "sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach ?> I have figured out a lot,w hen you pass the functions to the xml functions, it run's through them one at a time.I need to figure out one thing right now.When it come's in contact with that specific tag (the programme tag), I need to take the start/stop time's and calculate what is currently playing, I am clueless from this point.Some direction, any direction would be helpful at this stage.
  11. I revised some of my code, and made some changes, but there are still a few things I don't understand.That helps me to find the program tag.However the programme has 2 attributes <programme start="20070128230000 -0500" stop="20070129003000 -0500" channel="I45654.labs.zap2it.com">I need to also check the start/stop each time around.I need to do calculations, then when it finds one that matches what would be what is currently playing, I need it to get the title, adn sub-title. And save it in an array, so I can get to it later.below is what my new code looks like, after some more reading. <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction startElement($parser, $name, $attributes) { global $open_tags; $current_tag = $name; if ($format = $open_tags[$name]){ switch($name){ case 'programme': $a = "0"; break; default: break; } }}// function to end searchingfunction endElement($parser, $name) { global $close_tags; if ($format = $close_tags[$name]){ switch($name){ case 'programme': $a = "1"; break; } }}// function to take data from tagsfunction tagData($parser, $data) { global $current_tagswitch($current_tag){ case 'programme': echo('<h1>This is the article</h1>'); break; }}}// set variables (tags)$open_tags = array("programme" => "<programme>", "title" => "<title>", "sub-title" => "<sub-title>");$close_tags = array("programme" => "</programme>", "title" => "</title>", "sub-title" => "</sub-title>");$nowplaying = array(); // array to trap what is currently playingxml_set_element_handler($parser, "startElement", "endElement");xml_set_character_data_handler($parser, "tagData");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach ?>
  12. Ok, I have discovered some things. For one, I looked at my previous question, I figured that out.I am 100% amazed at the power of the Expat library. I dug into it, and got a skeleton that actually worked, and did some playing with it, so I was able to single out a couple of specific questions, I need some advice on. Here is my code for example.Example XML File <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE tv SYSTEM "xmltv.dtd"><tv source-info-url="http://labs.zap2it.com/" source-info-name="TMS Data Direct Service" generator-info-name="XMLTV" generator-info-url="http://www.xmltv.org/"> <channel id="I45654.labs.zap2it.com"> <display-name>52 ESPNU</display-name> <display-name>52 ESPNU GA60311:-</display-name> <display-name>52</display-name> <display-name>ESPNU</display-name> <display-name>ESPN University</display-name> <display-name>Sports Satellite</display-name> </channel> <programme start="20070128230000 -0500" stop="20070129003000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">Women's College Basketball</title> <sub-title lang="en">Michigan State at Rutgers</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP184406.0000</episode-num> <subtitles type="teletext" /> </programme> <programme start="20070129003000 -0500" stop="20070129020000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">Women's College Basketball</title> <sub-title lang="en">North Carolina at Maryland</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185707.0000</episode-num> <subtitles type="teletext" /> </programme> <programme start="20070129020000 -0500" stop="20070129033000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">High-School Basketball</title> <sub-title lang="en">St. John's (D.C.) vs. Mount St. Joseph's (Md.)</sub-title> <date>20070127</date> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP800174.1088</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129033000 -0500" stop="20070129050000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">High-School Basketball</title> <sub-title lang="en">Dematha (Md.) vs. Towson Catholic (Md.)</sub-title> <date>20070127</date> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP800174.1089</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129050000 -0500" stop="20070129060000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">Who's Number 1?</title> <sub-title lang="en">Greatest College Basketball Players</sub-title> <date>20070115</date> <category lang="en">Sports non-event</category> <category lang="en">Limited Series</category> <episode-num system="dd_progid">EP733145.0046</episode-num> <episode-num system="onscreen">07004</episode-num> </programme> <programme start="20070129060000 -0500" stop="20070129073000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Syracuse at Louisville</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185446.0000</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129073000 -0500" stop="20070129090000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">High-School Basketball</title> <sub-title lang="en">St. John's (D.C.) vs. Mount St. Joseph's (Md.)</sub-title> <date>20070127</date> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP800174.1088</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129090000 -0500" stop="20070129103000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">High-School Basketball</title> <sub-title lang="en">Dematha (Md.) vs. Towson Catholic (Md.)</sub-title> <date>20070127</date> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP800174.1089</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129103000 -0500" stop="20070129120000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">Women's College Basketball</title> <sub-title lang="en">North Carolina at Maryland</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185707.0000</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129120000 -0500" stop="20070129123000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">Bill Self Show</title> <desc lang="en">Head coach Bill Self discusses the week in Kansas basketball.</desc> <category lang="en">Sports talk</category> <category lang="en">Basketball</category> <category lang="en">Limited Series</category> <episode-num system="dd_progid">SH796411.0000</episode-num> </programme> <programme start="20070129123000 -0500" stop="20070129143000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Hockey</title> <sub-title lang="en">Holy Cross vs. Quinnipiac</sub-title> <desc lang="en">From the TD Banknorth Sports Center in Hamden, Conn.</desc> <date>20070128</date> <category lang="en">Sports event</category> <category lang="en">Hockey</category> <category lang="en">Series</category> <episode-num system="dd_progid">EP047985.0934</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129143000 -0500" stop="20070129160000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Syracuse at Louisville</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185446.0000</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129160000 -0500" stop="20070129173000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Michigan State at Ohio State</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185706.0000</episode-num> <previously-shown /> <subtitles type="teletext" /> </programme> <programme start="20070129173000 -0500" stop="20070129180000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">ESPNU Recruiting Insider</title> <desc lang="en">Analysts discuss top high-school prospects and their college choices.</desc> <category lang="en">Sports talk</category> <category lang="en">Football</category> <category lang="en">Special</category> <episode-num system="dd_progid">SH855565.0000</episode-num> </programme> <programme start="20070129180000 -0500" stop="20070129190000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">ESPNU Bracketbusters Selection Show</title> <category lang="en">Sports non-event</category> <category lang="en">Basketball</category> <category lang="en">Special</category> <episode-num system="dd_progid">SH894959.0000</episode-num> </programme> <programme start="20070129190000 -0500" stop="20070129210000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Hampton at North Carolina A&T</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185899.0000</episode-num> </programme> <programme start="20070129210000 -0500" stop="20070129230000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Mississippi Valley State at Grambling State</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185900.0000</episode-num> <subtitles type="teletext" /> </programme> <programme start="20070129230000 -0500" stop="20070130010000 -0500" channel="I45654.labs.zap2it.com"> <title lang="en">College Basketball</title> <sub-title lang="en">Pepperdine at Santa Clara</sub-title> <category lang="en">Sports event</category> <category lang="en">Basketball</category> <episode-num system="dd_progid">SP185901.0000</episode-num> <subtitles type="teletext" /> </programme></tv> PHP File <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction starttag($parser, $element_name, $attributes) { case}// function to end searchingfunction endtag($parser, $element_name) {}// function to take data from tagsfunction tagdata($parser, $data) { echo $data; echo "<br />";}xml_set_element_handler($parser, "starttag", "endtag");xml_set_character_data_handler($parser, "tagdata");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's$nowplaying = array();//foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen("I10021.labs.zap2it.com.xml", "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";//}// close foreach ?> Notes* There are a total of 100+ files* I need to run through them in a foreachI am not to that step, and I am trying to do something else (get an understanding of how the basic structure works)I understand this, but here are my questions.1. I understand how to set a foreach for the start tag, and do what is necessary for that, how does the start tag, understand what is happening on the data. I don't understand there relationship.For example, I need to tell it at the start tag, to do this, this, and this to the data. How do I tell it to do that, since the data function is seperate?2. I need to find the starttime/stoptime of each programmer. Even when I dump all the data, the start/stop time doesn't come up. How do I, or what can I change with my code, to give me access to that information so I can test the proper calculations?3. I don't understand what is happening when I put it in a foreach. Doing it this way I have something to work with. However when I throw a foreach around it using the file names in the array, it doesn't work. It goes through file one, starts up the second file, and put's out a message that says everything else is junk (something php throws out), then stops anything else from happening. How can I get a foreach loop to work around this once I get it doing exactly what I want on the first file?Thank you for the help.
  13. Ok, I went through about 8 tutorials, and got something together. When I had a bunch of error's I didn't understand what was going on, after a lot of reading and lot of tutorials I was able to form something that works, atleast for basic parsing.The situation is a little hard to explain, I have a client getting xml file's from zap2it and he saved them on his server daily. The main file is menu.xml, everything with it is already taken care of. In menu.xml it has information on all the television channels. Then each channel has there own xml file's that get updated daily. I needed a way to run through those, pick out the show's that are currently playing, and display them on the screen. The script I ahve so far, is doing a pretty good job of setting up the groundwork for what I want to do, but it's just not coming together, mostly because I don't know how to advance. After a lot of work, I was able to remove all errors, which helped, and it works. However I don't know what to do from here, to get what I want done.Each channel is in a seperate page, here is some example coding, that a channel might contain: <programme start="20070129140000 -0500" stop="20070129150000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">mtvU Video Hour</title> <category lang="en">Music</category> <category lang="en">Series</category> <episode-num system="dd_progid">SH684893.0000</episode-num>Start File </programme> <programme start="20070129150000 -0500" stop="20070129160000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">mtvU Video Hour</title> <category lang="en">Music</category> <category lang="en">Series</category> <episode-num system="dd_progid">SH684893.0000</episode-num> </programme> <programme start="20070129160000 -0500" stop="20070129170000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">BFOC Student Film of the Week</title> <sub-title lang="en">Urban Shogun</sub-title> <date>20070126</date> <category lang="en">Art</category> <category lang="en">Limited Series</category> <episode-num system="dd_progid">EP895481.0001</episode-num> <episode-num system="onscreen">101</episode-num> </programme> There are a total of 100+ channel specific xml file's I have to work through.The current setup I have is meant to run through all of them, as I have all the file name's saved in an array. here is my code, and below is a few questions, I just couldn't make progress on. <?php// Build an array with all the channel names.$channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names.// register empty array to hold the upcoming information$files = array();// run through all the channels, assining there full file names into an arrayforeach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array}// attempt to create an xml parserif (!$parser = xml_parser_create()) { exit("There was a problem creating the parser");}// Functions To go into the element handlers, later on// variables to pass to user functions// function to start searchingfunction starttag($parser, $element_name, $attributes) { echo "Hello start element"; echo "<br />";}// function to end searchingfunction endtag($parser, $element_name) { echo "Hello end element"; echo "<br />";}// function to take data from tagsfunction tagdata($parser, $element_name) { echo "Got data"; echo "<br />";}xml_set_element_handler($parser, "starttag", "endtag");xml_set_character_data_handler($parser, "tagdata");// use the file array created earlier to get to work// create an array to hold information on all the currently playing shows// from all the xml file's$nowplaying = array();foreach ($files as $k => $v) { // run through all the file'secho "Start File";echo "<br />";echo "<br />"; if (!$open = fopen($v, "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($parser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($parser)); $reason .= xml_get_current_line_number($parser); die($reason); } }echo "End File";echo "<br />";echo "<br />";}// close foreach ?> 1. This doesn't seem to cycle through all documents. It does 1, then says at the very bottom (out of nowhere) "Start Filejunk after document element77" Why is this?2. Is it possible to cycle through all xml file's using this foreach3. How do I tell it to look for something specific, I need it to do the following* Go into file 1* Go through each set of programme tag's, check the starttime/stoptime with some calculations to see which one would currently be playing. * When it finds one in file one that is currently playing, throw it in an array, and move onto the next file* Repeat for all the rest of the file's.This is what I am wanting to do, but don't know how to put it together, any guidance based on my above code, would be greatly appreciated. I have done all I can myself, and now I am running around in circles trying to find out what's next.
  14. I am Joyel Puryear, own of http://www.freelancebusinessman.comI do freelance web development (programming, coding, design, and misc) related web work.I come to the forums to ask help on advice sometimes with different aspects of coding, programming, sometimes misc stuff, because sometimes i get stuck, need a helping hand.
  15. yes, why.It depends if you want rounded corners, then simply use curvy corners.If you want rounded images, they are easy, you can use flash, or php to dynamically create the images, make them round instead.In photoshop you can also make them round, they don't have to be squared, that's prefences. There are round images all over the place, and other shapes as well.
  16. Try it without the inherit part, that could be what's causing that.
  17. You can use either, but you have to remember some browsers only use certain font's, not all font's are supported in all browsers. If you are wanting font freedom, use images, for where you want those special font's to be, then you are only limited by what font's are on your computer.Browser's can read them off an image, they just can't rended the font's they don't have.If you do set a font, browsers don't have, alway's leave it set so they can pick there own browser defaults, and understand sometimes the browser defaults or user-style sheets aren't the best in the world.
  18. Hate to bother you again, but I could really use some help. If this is possible, thanks.I am still playing with it, but have yet to get anywhere, I have been playing with borders, margins, paddings, and everything but things are still not working up.
  19. I have it working perfectly in firefox now, but I am having troubles with it in ie, and opera, any advice.
  20. I finally got this entire layout coded, but it has a few problems.It took quite awhile to get it this far.Here is a link to the website.http://www.hasbadservice.com/admintemplate.phpNow there are a few problems 1. In all 3 browsers, it's making my text appear WAY off, it's suppose to be in the top div2. In firefox other than that 1 thing it looks ok, in ie, it's misaligned too the right, and in opera, it's misaligned up and down, along with the text problem also, if anyone can see what is causing these problems and help me fix it would be greatly appreciated.
  21. Can someone look at that, and see what exactly is that is causing that, but more of, I would like to find out, why it's causing that.I am not understanding the general idea, I have 2 background images.They seem proper but for some reason, one of the div's isn'tright, I can't figure out what about this, is not working.
  22. Can someone please tell me what's wrong with this.For now I just need the basics to work.I don't want to add any more, until this works, for some reason the top part is above the div, is there something I am doing wrong, or something I can do better in my css, this is starting to come together some but slowly, and with problems.http://www.hasbadservice.com/admintemplate.php body { text-align: center; background-color:#999999;}#header { margin-left:auto; margin-right:auto; width:50em; height:8em; background-image:url(images/header.jpg); clear:both;}.font1 { font-family:Arial, Helvetica, sans-serif; font-size:1.5em; float:left; margin-top:80px; margin-left:25px; color:#FFFFFF;}#wrapper { margin-left:auto; margin-right:auto; width:50em; height:auto; background-image:url(images/bodyoutline.gif); background-repeat:no-repeat; clear:both;}#top { width:45em; margin-left:auto; margin-right:auto; background-image:url(images/top.gif); background-repeat:no-repeat; height:2em;}
×
×
  • Create New...