User Profile

Collapse

Profile Sidebar

Collapse
npm
npm
Last Activity: Dec 27 '14, 06:13 PM
Joined: Apr 26 '07
Location: USA
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • npm
    started a topic Get attribute value of parent node
    in PHP

    Get attribute value of parent node

    I'm trying to list the 10 most recent programs from my XML file (in a dropdown menu). In my PHP code, I'm having trouble accessing/echoing part of the attribute (ym) of the parent element (month) of each show.

    XML:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <shows>
    <month ym="201411">
      <show>
        <dt>26</dt>
        <wd>Wednesday</wd>
    ...
    See more | Go to post
    Last edited by npm; Dec 27 '14, 03:52 AM. Reason: I accidentally submitted it before I was finished. Whoops...

  • Function works first time, but not subsequent times

    Hi,
    I'm trying to post song samples on a site and I've got a function that is supposed to detect whether the browser is IE (so it can embed Windows Media Player), supports mp3 in the HTML5 <audio> tag, or just embeds the mp3 for a plugin like QuickTime.

    The problem is that the function works fine for the first song sample, but doesn't when I call it for other songs. Here's the function:

    Code:
    function audioEmbed(targetDiv,fileName)
    ...
    See more | Go to post

  • npm
    replied to Why does this not parse xml?
    in PHP
    The server is from an outside company. I've contacted them about the possibility of an upgrade. Thank you all for your time, however in vain in turned out to be. :)
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    I ran the above code and got this:

    Fatal error: Call to undefined function: load() in /home/httpd/vhosts/csnradio.com/www/test/2.php on line 3

    Now what?
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    Just to make sure...change it to, and run the following?
    Code:
    <?php
    $dom = new DOMDocument();
    $dom->load("xml.xml");
    $menu = new DOMXPath($dom);
    $entries = $menu->query("//menu/entry");
    print_r($entries);
    ?>
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    Sorry, just for clarification, here's a visual of what I changed it to:
    Code:
    <?php
    $dom = new DOMDocument();
    $dom->load("xml.xml");
    $menu = new DOMXPath($dom);
    foreach($menu->query("//menu/entry") as $entry) {
    	print "Action is: " . $menu->query('.//action',$entry)->item(0)->nodeValue;
    	print "Title is: " . $menu->query('.//title',$entry)->item(0)->nodeValue;
    ...
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    Would the error be a setting or something with the actual server or in that version of PHP (4.1.2)?

    I just don't see where the "," or the ";" should go.

    This might be something, but I don't know what:
    I switched both of the "echo" commands in lines 6-7 to "print" and now I get this error:

    Parse error: parse error in /home/httpd/vhosts/csnradio.com/www/test/2.php...
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    I know...

    I don't see where the error is AND it's been almost 7 years since 5.0.0 was released!
    See more | Go to post

    Leave a comment:


  • npm
    replied to Why does this not parse xml?
    in PHP
    I can't use SimpleXML because the server is running PHP 4.1.2. If I'm not mistaken, one needs version 5 to use SimpleXML, right?

    I can see that the error is expecting a comma or a semicolon, but I don't know enough about php to know where they would go. Especially because the code is basically copied straight from a tutorial from someone who most likely had it working on their end.
    See more | Go to post

    Leave a comment:


  • npm
    started a topic Why does this not parse xml?
    in PHP

    Why does this not parse xml?

    Here's the sample xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <menu>
    	<entry>
    		<action>
    			Test
    		</action>
    		<title>
    			Test Menu Item 1
    		</title>
    	</entry>
    	<entry>
    		<action>
    			Test 2
    		</action>
    		<title>
    			Test Menu Item 2
    		</title>
    ...
    See more | Go to post

  • Why won't the android browser won't load and/or display my XML data?

    I'm trying to find out why the android browser won't load and/or display my XML data. This javascript works fine on computer browsers (FF, IE, Safari, Chrome, Opera) and even in iPhone's Safari, but when I view the same page in my android's browser, nothing is displayed...it' s just blank. Is it a javascript bug in the android browser?

    Code:
    <html>
    <head>
    <script type="text/javascript">
    ...
    See more | Go to post

  • Why won't the android browser load/display xml?

    I'm trying to find out why the android browser won't load and/or display my XML data. It works fine on computer browsers (FF, IE, Safari, Chrome, Opera) and even in iPhone's Safari, but when I view the same page in my android's browser, nothing is displayed...it' s just blank.

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function loadXMLDoc(dname) {
    	var xmlDoc;
    	if (window.XMLHttpRequest)
    ...
    See more | Go to post

  • npm
    started a topic How can I play an animation when audio is streaming?

    How can I play an animation when audio is streaming?

    I have a streaming audio player that works, but I want to add a movie clip that plays when the audio is actually streaming and stops when the audio stops. So far, my actionscript plays the animation right away, when I push the play button, even before the audio is actually playing.

    Here's my code:
    Code:
    function getSound(url:String) {
    	sound.stop();
    	delete sound;
    	sound = new Sound();
    	sound.loadSound(url,
    ...
    See more | Go to post

  • Well, now I've made some progress, but it's not quite there.

    Code:
    <?php
    // Get information from file //
    $IPs = "IPs.txt";
    $fp = fopen($IPs, "r");
    $ipList = fread($fp, filesize($IPs));
    fclose($fp);
    
    // Explode line breaks //
    $bannedIPs = explode("\n", $ipList);
    
    // Get new IP //
    $ipNew = $REMOTE_ADDR;
    
    // Check to see
    ...
    See more | Go to post

    Leave a comment:


  • The thing is that I'll be initially setting up over 100 separate polls (with more to come) and I'll need a text file for each poll to store the IPs of the voters.

    I know about the dynamic IP thing. It's not too big of a deal. This will just be to keep most people from voting a bunch of times on the same poll.
    See more | Go to post

    Leave a comment:


  • How to read and add to an array then write it to a text file

    I'm setting up a polling system where voters can only vote once, based on their IP address.

    When the poll loads I want to open the text file with the list of blocked IPs to see if a voter has already voted. If not, they vote and then their IP should get added to the array and then the updated array get written back to the text file.

    Here's the code I have so far:
    Code:
    <?php
    // Get information from
    ...
    See more | Go to post

  • That makes sense.

    But is there a way to use innerHTML (or some other method instead of document.write) to display the whole list. I ask because I have lists from each state, and I'd like to have one script (maybe at the end of the page) that would display the appropriate data into each <div>. Right now I have 4 scripts (each using document.write) for each of the 50 states to display different data. It just seems like it would...
    See more | Go to post

    Leave a comment:


  • npm
    started a topic Why does innerHTML only display one line of XML?

    Why does innerHTML only display one line of XML?

    Given that x.length is whatever number (let's say 20), then why does this:
    Code:
    <script type="text/javascript">
    xmlDoc = loadXMLDoc("stations.xml");
    x = xmlDoc.getElementsByTagName('city');
    for (i=0;i<x.length;i++) {
    if (x[i].parentNode.parentNode.getAttribute('id2')=='TX') {
    document.write(x[i].childNodes[0].nodeValue + "<br />");
    }
    }
    </script>
    ...
    See more | Go to post

  • npm
    started a topic setInterval / setTimeout freezing browser?

    setInterval / setTimeout freezing browser?

    Hi,
    Has anyone seen this before? I have a "Now Playing" section for a radio station that displays what song is currently on the air. The on-air computer uploads an xml file with the song title, artist and album name. Then I use a javascript function that loads/displays the xml file and I've been using setInterval or setTimeout to have it update itself.

    Here's the xml:
    Code:
    <?xml version="1.0"
    ...
    See more | Go to post

  • Using Javascript to list xml node list in reverse order

    Hi,
    This javascript will display my xml node list:
    Code:
    x=xmlDoc.getElementsByTagName('title');
    for (i=0;i<x.length;i++) {
    document.write(x[i].childNodes[0].nodeValue);
    document.write("<br />");
    }
    But I want to display the list in reverse order. I think it would work to put the nodes into an array and then use reverse() to switch it, but I'm not sure exactly how......
    See more | Go to post
No activity results to display
Show More
Working...