Jump to content

Texan78

Members
  • Content Count

    272
  • Joined

  • Last visited

Everything posted by Texan78

  1. Well, come to find out this isn't working after all. <?php if ($status[2] < true) { echo "<span class='label label-success'>LIVE</span>"; } else { echo "<span class='label label-important'>OFFLINE</span>"; } ?>
  2. I am sure I am having a brain fart and just need some extra eyes as I am overlooking something. I am trying to do a very simple IF statement but, for some reason it is not working. Here is what I have. <?php if ($status[1] < true) { echo $location[1]; } ?> I have also tried it this way and it won't work ether. <?php if ($status[1] < true) echo $location[1]; ?> I am using that same $status variable in a different ELSE/IF statement and it works fine but, for some reason it is not working for this. Logic behind how this is suppose to work. This is pulling from a database and I can echo the $location variable just fine so I know that is working. $status also comes from the database with a value of ether true or false. So what I am trying to do is if the $status value is true then echo $location which is just the location which is in the DB. For some odd reason which I am sure it is something simple I am overlooking, it is not working. If anyone could offer my tired eyes some input that would be greatly welcomed. -Thanks
  3. I hate javascript and working with Google maps but, anyways. I am trying to update my old maps to a new style. Here is the new style. http://www.mesquiteweather.net/lsm/map.html I am trying to added the markers to the map from an XML file which is this one. http://www.mesquiteweather.net/tracker/data.xml It should look like this. http://www.mesquiteweather.net/wxspotter.php I have transferred the code over to the updated map style but, for some reason it isn't displaying the markers. Can someone please tell me what it is I am missing or doing wrong which I am sure is a lot since I am horrible with javascript. Here is the code to the updated map that I am trying to show the XML markers on. http://pastebin.com/rFVG4nJS -Thanks
  4. Yes it is possible that it could contain more than one element. What will I do multiple items in the array? Hopefully ignore them. For what I am trying to do right now I just need the name and hopefully I can use that as a value to trigger a true or false so I can show online or offline. This XML file doesn't leave much to work with. I wish it had an active key under a certain element for a user like the old one had but, it does not. I don't need the value of [name] persay, but rather use that as if that value exists then true if not false. Is something like the possible? -Thanks
  5. Hello, I will try to keep this short and sweet. This small script I have the data source has changed and I need a way to trigger an online and offline tag. Which was really easy with how the JSON data file was set up before. Now things are a little more complicated and I am not sure how to approach this. Here is the code I am working with that needs to be updated. I need to change out where the $status varible is to use the [name] key and if there is a value then show as online. If it is empty or doesn't exist show as offline. As this key isn't a normal true false value how can I approach this so that if the key has a value then set as true? // Lets get and parse the data and create the variables $json_string = file_get_contents($jsonPath); $parsed_json = json_decode($json_string); $status = ($parsed_json->active) ? 'true' : 'false'; // Lets assembly the banners to display $online = '<span class="label label-success"> ONLINE</span>'; $offline = '<span class="label label-danger"> OFFLINE</span>'; if ($status == "true") { echo $online; } else { echo $offline; } Here is a sample of the JSON file which was XML that I have parsed to JSON to get the keys. I need to get to the [name] and if there is a vaule set as true. Hopefully this makes sense. I can't find anything that talks about this but, then again. I am really not sure how to word it or what exactly I am looking for. Array ( [0] => Array ( [name] => live [live] => Array ( [stream] => Array ( [name] => rcontreras [time] => 2969160 [bw_in] => 342512 [bytes_in] => 186226066 [bw_out] => 533112 [bytes_out] => 285996865 [bw_audio] => 0 [bw_video] => 342512 [client] => Array If anyone can offer some assistance that would be great! This has been bothering me for weeks. -Thanks
  6. Thanks, yeah you are right. I noticed that after the fact. That is where I am stuck is I need to pull just that data but keep it together from each line. My brain is fried at the moment from trying to remember how to use this all over again. ## Start Configurable data ## //Set path to data file $data = "http://www.spotternetwork.org/data.php"; ## End Configurable data ## $xml = simplexml_load_file($data); //Set initial output to false foreach($xml->spotter as $spotter) { $name = $spotter['name']; $lat = $spotter['lat']; $long = $spotter['lng']; );
  7. Hello, I am the Senior Project Manager for an established web site that is looking to add a new live streaming feature to our site. We have most of the section laid out for demo purposes. Background, we will be streaming live storm chases. The streaming server is already set up and is solid but, if you have experience in NGINX RTMP MODULE that is a plus. It is running on a VPS and is up and running but might need some tweaking. The main thing we are needing is someone one is very fluent working with PHP and Javascript. 3-5+ experience. Working with Google Maps is a must as well. Possible MySQL DB experience may be needed to complete this project. What we are needing. We have two separate pages. One is a video wall that will show all the active streams. We are looking for someone who can parse the XML file from the NGINX streaming server and dynamically show the active player. We are using JWPlayer for this to show the streams which is self hosted. Then when the stream is over it goes away. This will probably need to be updated with JQuery but update it so it does not update the entire page and cause the other current streams to stop. It will need to show their name and location in the header of the div container. Right now they are just statically placed. We only need the wall to show active streams only. The containers and players are already set up. We need someone to make them dynamic and only show the active streams. Second is a Google Map. We have a data feed that will show users locations on a map. We have the base map built on Google Maps V4. We currently have a working example using V3. If you can port over the locations from the data feed from the V3 map that would be great or write something from scratch. Also we need to place the persons player in the info box when someone clicks on their icon on the map with the name and location above the player. The data feed we have for the peoples location needs to only show certain people from that data feed. We have all the data feeds to work with and we run the streaming servers. We just need someone who can tie in the loose ends and do the back end heavy lifting as we are on a short time frame. For example of the pages and more information please send me a PM and I can give you more information. Please provide in your PM your experience and possible demo work you have done in the past as well as an initial quote. -Thanks
  8. Hello, I am look for some assitence on a project I am working on. It has been a couple years since I have done something like this and I know it is easy to do as I have done it before but, I have forgot some of it. I am trying to parse this feed http://www.spotternetwork.org/data.php and create variables for the lat, lng and name so I can plot them on a Google Map V4. I do not think I am going about this the right way since those are child nodes and I have completed forgot out to use DOM which I think that is what I need to be using. Right now I am just trying to get it parsed and go from there. Also I need the lat lng to coincide with the name. ## Start Configurable data ## //Set path to data file $data = "http://www.spotternetwork.org/data.php"; ## End Configurable data ## $xml = simplexml_load_file($data); //Set initial output to false $tData = false; foreach($xml->spotter as $spotter) { $name = $spotter['name']; $lat = $spotter['lat']; $long = $spotter['lng']; echo $spotter; Any help would be greatly appreciated. -Thanks
  9. Would this be correct then for displaying the message per the code you supplied? It works but, just want to make sure the if statement is the correct way. BTW, thank you for your help. $message = ''; // default to an empty string for the result foreach($alertValues as $value){ // loop over the $alertValues array if(in_array($value,$events)){ // checking if each value in turn is in the $events array $message = $value; // a match was found, save it as the result break; // stop on the first match } } //Display weather radio banner if alert is found if($message) { echo '<div style=' . $bannerStyle . '> <strong>WEATHER BROADCAST ALERT - ' . $message . '</strong>... Dallas County, listen now to our LIVE NOAA Weather Radio Stream <a href=" ' . $feed . '" class="NWRLink" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County">[Click here to listen]</a></div>'; } I am not sure what you were referring to but did you mean the $alertValues array? While it may have been incorrect, it was working and pulling the highest alert at the time which wasn't the last event added. Before when it was looping through all of them it was showing 5-6 different banners at the same time instead of just one, the one being the highest as I wanted. The highest being Severe Thunderstorm Warning and lowest being Flood Warning at that time. Once I used the first code I had put together it worked and only showed one banner as I wanted to and it was Severe Thunderstorm Warning, once that expired it showed the next highest one which was Tornado Watch, then once it expired, it showed the next lowest one which was Flood Warning. So it was working, the logic may have just not been correct. Since I don't know the difference, if it works, I assume it's correct. Which is why I asked if it was correct. I do appreciate your help.
  10. Well, after playing with it some more this is what I did and it seems to be working. I am not sure if this is right but, it is working at the moment. // Lets assembly the banners to display if (in_array($event->nodeValue, $alertValues)) { echo '<div style=' . $bannerStyle . '> <strong>WEATHER BROADCAST ALERT - ' . $message . '</strong>... Dallas County, listen now to our LIVE NOAA Weather Radio Stream <a href=" ' . $feed . '" class="NWRLink" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County">[Click here to listen]</a></div>'; }
  11. YES!, That is exactly what I am needing but, how would that work exactly? How would I set up the in_array()? This is what I have come up with but, it's not working so I know I am doing something wrong. According to the examples I have read this should work. The in_array() is at the bottom of the code. //Set path to data file #$data = "http://alerts.weather.gov/cap/".$zone.".atom"; $data = "http://alerts.weather.gov/cap/wwaatmget.php?x=".$zone."&y=1"; ## End Configurable data ## $alertColor = ' '; $alertText = '#FFF'; $event = ' '; // get path info & protect for cross-site scripting vulnerability $sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : ''; // Lets parse the feed $dom = new DOMDocument(); $dom->load($data); $events = []; foreach ($dom->getElementsByTagNameNS("urn:oasis:names:tc:emergency:cap:1.1", "event") as $event) { $events[] = $event->nodeValue; } $alertValues = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Tornado Watch', 'Severe Thunderstorm Watch', 'Flash Flood Warning', 'Flood Warning', 'Flash Flood Watch', 'Flood Watch', 'Flood Advisory', 'Winter Storm Warning', 'Winter Storm Watch', 'Winter Weather Advisory', 'Special Weather Statement'); $events = array_intersect($alertValues, $events); // Set the alert colors for the banner background switch($event->nodeValue) { case 'Tornado Warning': $alertColor = 'rgba(255, 0, 0, 0.4)'; break; case 'Severe Thunderstorm Warning': $alertColor = 'rgba(255, 165, 0, 0.4)'; break; case 'Tornado Watch': $alertColor = 'rgba(255, 255, 0, 0.4)'; break; case 'Severe Thunderstorm Watch': $alertColor = 'rgba(219, 112, 147, 0.4)'; break; case 'Flash Flood Warning': $alertColor = 'rgba(139, 0, 0, 0.4)'; break; case 'Flash Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Warning': $alertColor = 'rgba(0, 255, 0, 0.4)'; break; case 'Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Advisory': $alertColor = 'rgba(0, 255, 127, 0.4)'; break; case 'Winter Storm Warning': $alertColor = 'rgba(255, 105, 180, 0.4)'; break; case 'Winter Storm Watch': $alertColor = 'rgba(70, 130, 180, 0.4)'; break; case 'Winter Weather Advisory': $alertColor = 'rgba(123, 104, 238, 0.4)'; break; case 'Special Weather Statement': $alertColor = 'rgba(255, 228, 181, 0.4)'; } // Lets assign some styles for the banner $bannerStyle = '"color:' . $alertText . '; width:100%; border-top-style:solid; border-bottom-style:solid; border-color:#FFF; border-width:1px; font-size:12px; text-shadow: 0 1px 1px #111; font-weight:700; font-family: Arial,Helvetica,sans-serif; text-align: center; background-color:' . $alertColor . '; margin-bottom:5px; padding: .2em 0em .2em 0em"'; // Lets assembly the banners to display if (in_array($events, $alertValues)) { echo '<div style=' . $bannerStyle . '> <strong>WEATHER BROADCAST ALERT - ' . $message . '</strong>... Dallas County, listen now to our LIVE NOAA Weather Radio Stream <a href=" ' . $feed . '" class="NWRLink" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County">[Click here to listen]</a> </div>'; }
  12. The problem isn't the color anymore. I have gotten that sorted. What I can't seem to resolve is for it to only show one single entry from the array and not loop through all of it and display everything it is able to match from the RSS feed it is parsing. I just need to display a single entry by priority which is set in the array. In case it was missed above, here is the array and this is the order in which a SINGLE entry should display if the rss contains this. At this time, it will display multiple entries if it is contained in the rss feed which I don't want, only a single entry set by it's priority. $alertValues = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Tornado Watch', 'Severe Thunderstorm Watch', 'Flash Flood Warning', 'Flood Warning', 'Flash Flood Watch', 'Flood Watch', 'Flood Advisory', 'Winter Storm Warning', 'Winter Storm Watch', 'Winter Weather Advisory', 'Special Weather Statement');
  13. I have done a lot of searching of how I can loop through this array and only display a single entry from the array if one of those values exsist in the RSS feed. How can I do this without using foreeach? Otherwise it works great, I just only need to display one and it is the one with the most priority and the priority is set by the order they are listed in the array. How can I accomplish this? -Thanks
  14. Disregard this post. I found an alternative method. Created a php script on my server that parses the XML file then call it internally from the program using the remote file option and it works great.
  15. Hello, first let me say I am HORRIBLE with Javascript. I am using this program called Xsplit for live streaming. It has the ability to add the title from an RSS feed. That is great but, I would also like to add another node called "summary" and I will be honest, I have no clue after trying several things and searching the net. Here is the script it uses. /* This shows title of RSS feed entries from [RSS_FEED_URL] each item sepated by "||", number of entries shown can be specified using the [NUMBER_OF_ENTRIES] variable. This only checks for feed once (on scene load) */ /** * @name RSS_FEED_URL * @label RSS Feed Url * @type text */ var RSS_FEED_URL = "http://alerts.weather.gov/cap/wwaatmget.php?x=TXZ119&y=1"; /** * @name NUMBER_OF_ENTRIES * @label Number of Entries * @type spinner * @min 1 * @max 20 * @step 1 * @description Values, 1-20 */ var NUMBER_OF_ENTRIES = 8; /*Do not modify anything below*/ scriptLoading(); function scriptLoading(){ var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = "http://www.google.com/jsapi"; newScript.onload = initial; headID.appendChild(newScript); } function initial(){ google.load("feeds", "1", {"callback" : initialize}); } var CombinedEntries=""; var initialize = function() { var feed = new google.feeds.Feed(RSS_FEED_URL); feed.setNumEntries(NUMBER_OF_ENTRIES); feed.load(function (result) { if (!result.error) { var container = document.getElementById("feed"); var entries = new Array(); var i=0; for (; i < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; entries[i] = entry; CombinedEntries=CombinedEntries+" || "+entry.title"; } SetText(CombinedEntries, "RSS Feed Reader: " + RSS_FEED_URL); } }); }; if (smlTitleTimeouts && smlTitleTimeouts != null) clearTimeout(smlTitleTimeouts); This line adds the title, that much I can tell. CombinedEntries=CombinedEntries+" || "+entry.title"; If I try to add another line but change title to summary it comes back undefined. So how could I add another another node. Both title and summary are both under the same parent node which is "entry". I would just like to add "summary" to this as well but not sure how. Can anyone help me out? -Thanks
  16. I have tried your suggestion but then it doesn't show any color background. I have tried this, which works... switch($event->nodeValue) { Problem I am having now is, it should only be showing one alert but it shows multiple alerts if they are in the array. They are listed in the array by the order in which I wanted them to display if they exist in the RSS feed I am parsing. So for example, it should only be displaying Flood Warning and not Flash Flood Watch. Here is the relevant code.... $alertValues = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Tornado Watch', 'Severe Thunderstorm Watch', 'Flash Flood Warning', 'Flood Warning', 'Flash Flood Watch', 'Flood Watch', 'Flood Advisory', 'Winter Storm Warning', 'Winter Storm Watch', 'Winter Weather Advisory', 'Special Weather Statement'); $events = array_intersect($alertValues, $events); // Set the alert colors for the banner background switch($event->nodeValue) { case 'Tornado Warning': $alertColor = 'rgba(255, 0, 0, 0.4)'; break; case 'Severe Thunderstorm Warning': $alertColor = 'rgba(255, 165, 0, 0.4)'; break; case 'Tornado Watch': $alertColor = 'rgba(255, 255, 0, 0.4)'; break; case 'Severe Thunderstorm Watch': $alertColor = 'rgba(219, 112, 147, 0.4)'; break; case 'Flash Flood Warning': $alertColor = 'rgba(139, 0, 0, 0.4)'; break; case 'Flash Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Warning': $alertColor = 'rgba(0, 255, 0, 0.4)'; break; case 'Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Advisory': $alertColor = 'rgba(0, 255, 127, 0.4)'; break; case 'Winter Storm Warning': $alertColor = 'rgba(255, 105, 180, 0.4)'; break; case 'Winter Storm Watch': $alertColor = 'rgba(70, 130, 180, 0.4)'; break; case 'Winter Weather Advisory': $alertColor = 'rgba(123, 104, 238, 0.4)'; break; case 'Special Weather Statement': $alertColor = 'rgba(255, 228, 181, 0.4)'; } // Lets assign some styles for the banner $bannerStyle = '"color:' . $alertText . '; width:100%; border-top-style:solid; border-bottom-style:solid; border-color:#FFF; border-width:1px; font-size:12px; text-shadow: 0 1px 1px #111; font-weight:700; font-family: Arial,Helvetica,sans-serif; text-align: center; background-color:' . $alertColor . '; margin-bottom:5px; padding: .2em 0em .2em 0em"'; // Lets assembly the banners to display foreach ($events as $message) { echo '<div style=' . $bannerStyle . '> <strong>WEATHER BROADCAST ALERT - ' . $message . '</strong>... Dallas County, listen now to our LIVE NOAA Weather Radio Stream <a href=" ' . $feed . '" class="NWRLink" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County">[Click here to listen]</a> </div>'; } I think it is because of this below that is at the end of the code but I am not sure how to change that to only display one. I think the foreach statement makes it so it displays each value in the array. So how could I change that so it only shows the one with the most priority, priority is set in the array as the first one already? foreach ($events as $message) {
  17. Ah that makes perfect sense. I didn't think about the value being a boolean. Thank you very much for pointing that out. I was able to finish what I was needing to do with that value. Just to check my work for what I needed it for. Would this be correct? It seems to work and it is light weight. if ($status == "true") { echo $notify; } Meaning that if it is true, display the contents of the $notify variable. Seems to work through testing. Would this be correct, seeing any problems with that? -Thanks
  18. Hello, I have ran into a snag for something that is very elementary I am doing. It has been a while since I have worked with json and php so it could just be a simple lapse in memory. I have a json string I am trying to parse and this is the output of the string, very simple, cut and dry. All I need from that string is the "active" value. This is the very simple php code I have to parse it, which in the past works great and as outlined later works. <?php $jsonPath = "REMOVED_URL_BUT_GOES_HERE"; // URL to json data // Lets get and parse the data and create the variables $json_string = file_get_contents($jsonPath); $parsed_json = json_decode($json_string); $status = $parsed_json->active; echo $status; ?> So with the above php code when I echo the variable status, it should return the value as false but, instead I get nothing. Now as I said I would outline later, to troubleshoot and test if I do echo $json_string; then it outputs the entire string as it should so I know it is getting the contents. For some reason that I am simply overlooking it is not pulling the value for active for the $status variable. What am I missing or overlooking? -Thanks!
  19. Hello, I have a small script that depending on the title of the div the background has a different color. This use to work fine but, all of a sudden it just shows the color of the first case statement in the switch. Any suggestions what might be causing this? The title are based from an RSS feed that is parsed just for a little background on what is displayed and when. As you can see from the screen shot, this should be greenish color but, it is showing red and is taking the color of the first case. I tested this by removing the first one and then it shows yellow which is the second one. So that is how I determined it is not going down the line to display the correct color for the correct title. It is just stopping at the first title regardless if it is correct and just showing the first color. //Set path to data file #$data = "http://alerts.weather.gov/cap/".$zone.".atom"; $data = "http://alerts.weather.gov/cap/wwaatmget.php?x=".$zone."&y=1"; ## End Configurable data ## $alertColor = ' '; $alertText = '#FFF'; // get path info & protect for cross-site scripting vulnerability $sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : ''; // Lets parse the feed $dom = new DOMDocument(); $dom->load($data); $events = []; foreach ($dom->getElementsByTagNameNS("urn:oasis:names:tc:emergency:cap:1.1", "event") as $event) { $events[] = $event->nodeValue; } $alertValues = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Tornado Watch', 'Severe Thunderstorm Watch', 'Flash Flood Warning', 'Flash Flood Watch', 'Flood Warning', 'Flood Watch', 'Flood Advisory', 'Winter Storm Warning', 'Winter Storm Watch', 'Winter Weather Advisory', 'Special Weather Statement'); $events = array_intersect($alertValues, $events); // Set the alert colors for the banner background switch(TRUE) { case 'Tornado Warning': $alertColor = 'rgba(255, 0, 0, 0.4)'; break; case 'Severe Thunderstorm Warning': $alertColor = 'rgba(255, 165, 0, 0.4)'; break; case 'Tornado Watch': $alertColor = 'rgba(255, 255, 0, 0.4)'; break; case 'Severe Thunderstorm Watch': $alertColor = 'rgba(219, 112, 147, 0.4)'; break; case 'Flash Flood Warning': $alertColor = 'rgba(139, 0, 0, 0.4)'; break; case 'Flash Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Warning': $alertColor = 'rgba(0, 255, 0, 0.4)'; break; case 'Flood Watch': $alertColor = 'rgba(46, 139, 87, 0.4)'; break; case 'Flood Advisory': $alertColor = 'rgba(0, 255, 127, 0.4)'; break; case 'Winter Storm Warning': $alertColor = 'rgba(255, 105, 180, 0.4)'; break; case 'Winter Storm Watch': $alertColor = 'rgba(70, 130, 180, 0.4)'; break; case 'Winter Weather Advisory': $alertColor = 'rgba(123, 104, 238, 0.4)'; break; case 'Special Weather Statement': $alertColor = 'rgba(255, 228, 181, 0.4)'; } // Lets assign some styles for the banner $bannerStyle = '"color:' . $alertText . '; width:100%; border-top-style:solid; border-bottom-style:solid; border-color:#FFF; border-width:1px; font-size:12px; text-shadow: 0 1px 1px #111; font-weight:700; font-family: Arial,Helvetica,sans-serif; text-align: center; background-color:' . $alertColor . '; margin-bottom:5px; padding: .2em 0em .2em 0em"'; // Lets assembly the banners to display foreach ($events as $message) { echo '<div style=' . $bannerStyle . '> <strong>WEATHER BROADCAST ALERT - ' . $message . '</strong>... Listen now to our LIVE NOAA Weather Radio Stream <a href=" ' . $feed . '" class="NWRLink" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County">[Click here to listen]</a> </div>'; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.