Jump to content
#FlattenTheCurve ×

cowboysdude

Members
  • Content Count

    123
  • Joined

  • Last visited

Community Reputation

0 Neutral

About cowboysdude

  • Rank
    Advanced Member
  • Birthday 02/22/1963

Profile Information

  • Gender
    Male
  • Location
    Upstate NY
  1. Yes that helps VERY much!! I just adjusted to my vars and bingo..... Well I guess I just learned something new...... and I REALLY appreciate that!!! Thank you so much!
  2. Well that's what I keep hearing LOL "That's easy..." Like I said I'm sure I'm overthinking this Here is what I've tried: var langFile = this.langFile; var keys = Object.keys(this.langFile); var langFile = this.langFile[keys]; and the standard for (var i=0; i<this.langFile.lang.length; i++) { var langFile = this.langFile.lang[i]; console.log(langFile.languages); } Plus so many other things that I've read on the internet that my head is ready to explode Like I said I'm kinda new to this so be gentle hahaahhha Thank you!
  3. I am new to JS but have been trying for three days reading everything and anything I could find...trying new things... I cannot figure out how to parse this in js... It is a valid json file ... it's an object with what looks like arrays in it.. ? Here is part of it... you'll get the idea... { "lang": [{ "code": 1000, "day": "Sunny", "night": "Clear", "icon": 113, "languages": [ { "lang_name": "Chinese Simplified", "lang_iso": "zh", "day_text": "晴天", "night_text": "晴朗" }, { "lang_name": "Finnish", "lang_iso": "fi", "day_text": "Aurinkoinen", "night_text": "Pilvetön" }, { "lang_name": "French", "lang_iso": "fr", "day_text": "Ensoleillé", "night_text": "Clair" }, { "lang_name": "German", "lang_iso": "de", "day_text": "Sonnig", "night_text": "Klar" },{ "lang_name": "Spanish", "lang_iso": "es", "day_text": "Soleado", "night_text": "Despejado" }, { "lang_name": "Swedish", "lang_iso": "sv", "day_text": "Soligt", "night_text": "Klart" }] }, { "code": 1003, "day": "Partly Cloudy", "night": "Partly Cloudy", "icon": 116, "languages": [{ "lang_name": "Chinese Simplified", "lang_iso": "zh", "day_text": "局部多云", "night_text": "局部多云" },{ "lang_name": "Finnish", "lang_iso": "fi", "day_text": "Puolipilvinen", "night_text": "Puolipilvinen" }, { "lang_name": "French", "lang_iso": "fr", "day_text": "Partiellement nuageux", "night_text": "Partiellement nuageux" }, { "lang_name": "German", "lang_iso": "de", "day_text": "leicht bewölkt", "night_text": "leicht bewölkt" }, { "lang_name": "Spanish", "lang_iso": "es", "day_text": "Parcialmente nublado", "night_text": "Parcialmente nublado" }, { "lang_name": "Swedish", "lang_iso": "sv", "day_text": "Växlande molnighet", "night_text": "Växlande molnighet" }] I cannot for the life of me figure out to parse this thing...what I'm after is getting the code ... then the lang_iso so I can show users [who have their language already set] the text in their language... I am probably making this wayyyyyyyyyyyyy too hard but honestly I have tried every loop... every function.... and I cannot get the data I am after.. Help please and Thank you.
  4. Thank you!! I can work with either one... yeah I haven't run across this and it was throwing me for a loop!!! Thank you for the help it put me right on track!!
  5. I am not sure why this just isn't coming to me but for some reason it's stumping how to properly parse this thing!! Every line has it's own entry and trying to get the info for each match is proving somewhat puzzling for me! I can get any of the info but how for instance can I get both teams together since each team has it's own line and each match has 2 lines in it.... I'm trying to pull the data then make a table out of it but for some reason it's just escaping me totally.... http://www03.myfantasyleague.com/2012/export?TYPE=nflSchedule&W=19 That is the xml file... $team1 = $games->attributes()->id; that is how I am getting it but it return both teams..... how can I do this line by line? Any suggestions would be helpful! Thanks!
  6. Appreciate the input! But I'm thinking they added this to separate the 'content' media: category So it won't go past the 4th one... so I have to figure out my way around that one. You can see it when you go here: http://codebeautify.org/ and input your xml... it gives you an html 'tree view'.... So another adventure...
  7. Well I'm having a similar issue.. the following is only returning 2 results... there are many more..... cannot seem to figure out why... $feed = file_get_contents("http://www.dallascowboys.com/rss/video"); $xml = new SimpleXmlElement($feed); foreach ($xml->channel->item as $entry){ $date = $entry->pubDate; $title= $entry->title; $namespaces = $entry->getNameSpaces(true); $media = $entry->children($namespaces['media']); $date = $entry->pubDate; $title= $entry->title; $des= $entry->description; $link = $media->group->content[4]->attributes()->url; $thumb = $media->group->content[2]->thumbnail[3]->attributes()->url; Like I said this is returning 2 of the many possible results.... Anyone have any insight as to why? Thanks everyone!!!
  8. $visitingTeam = str_replace($find, $replace, $game['v']); It was working great until the TBD entered ... it works great all season but now that there is a TBD ... it's throwing things off.
  9. Here are my arrays. I'm using a search and replace with them... $find = array( "TBD", "ARI", "ATL", 'BAL', 'BUF', 'CAR', 'CHI', 'CIN', 'CLE', 'DAL', 'DEN', 'DET', 'GB', 'HOU', 'IND', 'JAC', 'KC', 'MIA', 'MIN', 'NE', 'NO', 'NYJ', 'NYG', 'OAK', 'PHI', 'PIT', 'STL', 'SD', 'SF', 'SEA', 'TB', 'TEN', 'WAS', 'RIC', 'IRV' ); $replace = array( "<img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/tbd.png'> TBD</a>", "<a href='http://www.azcardinals.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/cards.png'> Cardinals</a>", "<a href='http://www.atlantafalcons.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/falcons.png' > Falcons</a>", "<a href='http://www.baltimoreravens.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/ravens.png' > Ravens</a>", "<a href='http://www.buffalobills.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/bills.png' > Bills</a>", "<a href='http://www.panthers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/panthers.png' > Panthers</a>", "<a href='http://www.chicagobears.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/bears.png' > Bears</a>", "<a href='http://www.bengals.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/bengals.png' > Bengals</a>", "<a href='http://www.clevelandbrowns.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/browns.png' > Browns</a>", "<a href='http://www.dallascowboys.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/cowboys.png' > Cowboys</a>", "<a href='http://www.denverbroncos.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/broncos.png' > Broncos</a>", "<a href='http://www.detroitlions.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/lions.png' > Lions</a>", "<a href='http://www.packers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/packers.png' > Packers</a>", "<a href='http://www.houstontexans.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/texans.png' > Texans</a>", "<a href='http://www.colts.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/colts.png' > Colts</a>", "<a href='http://www.jaguars.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/jags.png' > Jaguars</a>", "<a href='http://www.chiefs.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/chiefs.png' > Chiefs</a>", "<a href='http://www.miamidolphins.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/dolphins.png' > Dolphins</a>", "<a href='http://www.vikings.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/viks.png' > Vikings</a>", "<a href='http://www.patriots.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/pats.png' > Patriots</a>", "<a href='http://www.neworleanssaints.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/saints.png' > Saints</a>", "<a href='http://www.newyorkjets.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/jets.png' > Jets</a>", "<a href='http://www.giants.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/giants.png' > Giants</a>", "<a href='http://www.raiders.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/raiders.png' > Raiders</a>", "<a href='http://www.philadelphiaeagles.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/eagles.png' > Eagles</a>", "<a href='http://www.steelers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/steelers.png' > Steelers</a>", "<a href='http://www.stlouisrams.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/rams.png' > Rams</a>", "<a href='http://www.chargers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/chargers.png' > Chargers</a>", "<a href='http://www.49ers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/49ers.png' > 49ers</a>", "<a href='http://www.seahawks.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/seahawks.png' > Seahawks</a>", "<a href='http://www.buccaneers.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/bucs.png' > Buccaneers</a>", "<a href='http://www.titansonline.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/titans.png' > Titans</a>", "<a href='http://www.redskins.com/' target='_blank'><img src='". JUri::base() ."/modules/mod_scores/assets/img/teams/redskins.png' > Redskins</a>", "Team Rice", "Team Irving" ); The question I have is that there is a TBD which is close to TB.. when the output is TBD it's using both outputs like this: TBD image TB image BuccanersD How can I get around the fact that they are so close? Thank you!
  10. That all makes sense!! Huge Thank you!!! Problem is I tend to make it harder then it has to be... LOL Again, Thank you!
  11. Well if you go back up to the top I have set $url to get the 'http://www.dallascowboys.com/rss/video', 'http://www.dallascowboys.com/rss/gallery', 'http://www.dallascowboys.com/rss/audio', 'http://espn.go.com/blog/feed?blog=nfceast', 'https://sports.yahoo.com/nfl/teams/dal/rss.xml', which comes from: /********* Feeds *********/ $urls = array($url); /********* Feeds *********/ it should be getting 'filled' from this: $url = $params->get('url'); which is a 'textarea' where users can put their urls like above and populate the array via the $url parameter.. It's not reading it for some strange reason... the print_r($url); was just to see if that $url was catching what was being put in the textarea in the module and it is.... problem is it's not translating later on down in the array() area....
  12. Here is the entire code... I see what you mean... JHtml::stylesheet('modules/mod_newsbanner/assets/css/styles.css'); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . 'modules/mod_newsbanner/assets/js/tickerme.js'); $url = $params->get('url'); echo '<div id="wrapper" style="margin-top:1px;">'; echo '<ul id="ticker">'; class Feed_Amalgamator { public $urls = array(); public $data = array(); public function addFeeds( array $feeds ) { $this->urls = array_merge( $this->urls, array_values($feeds) ); } public function grabRss() { foreach ( $this->urls as $feed ) { $data = @new SimpleXMLElement( $feed, 0, true ); if ( !$data ) throw new Exception( 'Could not load: ' . $feed ); foreach ( $data->channel->item as $item ) { $this->data[] = $item; } } } public function amalgamate() { shuffle( $this->data ); $temp = array(); foreach ( $this->data as $item ) { if ( !in_array($item->link, $this->links($temp)) ) { $temp[] = $item; } } $this->data = $temp; shuffle( $this->data ); } private function links( array $items ) { $links = array(); foreach ( $items as $item ) { $links[] = $item->link; } return $links; } } /********* Feeds *********/ $urls = array($url); /********* Feeds *********/ try { $feeds = new Feed_Amalgamator; $feeds->addFeeds( $urls ); $feeds->grabRss(); $feeds->amalgamate(); } catch ( exception $e ) { die( $e->getMessage() ); } foreach ( $feeds->data as $item ) : extract( (array) $item ); $truncated = (strlen($description) > 100) ? substr($description, 0, 80) . '...' : $description; ?> <li><img src="modules/mod_newsbanner/assets/images/slogo.jpg" width="19" height="19"> <?php echo $truncated; ?> <a href="<?php echo $link; ?>" target="_blank"><font color=red>Read More</font></a></li> <?php endforeach; ?> </ul> </div> <script> jQuery(function(){ jQuery('#ticker').tickerme(); }); </script>
  13. When I use the print_r($url); it returns 'http://www.dallascowboys.com/rss/video', 'http://www.dallascowboys.com/rss/gallery', 'http://www.dallascowboys.com/rss/audio', 'http://espn.go.com/blog/feed?blog=nfceast', 'https://sports.yahoo.com/nfl/teams/dal/rss.xml',<div id="wrapper" style="margin-top:1px;"><ul id="ticker">String could not be parsed as XML
  14. This the output: Array ( [0] => http://www.dallascowboys.com/rss/video [1] => http://www.dallascowboys.com/rss/gallery [2] => http://www.dallascowboys.com/rss/audio [3] => http://espn.go.com/blog/feed?blog=nfceast [4] => https://sports.yahoo.com/nfl/teams/dal/rss.xml )
  15. I'm currently parsing multiple rss/xml feeds using this: class Feed_Amalgamator { public $urls = array(); public $data = array(); public function addFeeds( array $feeds ) { $this->urls = array_merge( $this->urls, array_values($feeds) ); } public function grabRss() { foreach ( $this->urls as $feed ) { $data = @new SimpleXMLElement( $feed, 0, true ); if ( !$data ) throw new Exception( 'Could not load: ' . $feed ); foreach ( $data->channel->item as $item ) { $this->data[] = $item; } } } public function amalgamate() { shuffle( $this->data ); $temp = array(); foreach ( $this->data as $item ) { if ( !in_array($item->link, $this->links($temp)) ) { $temp[] = $item; } } $this->data = $temp; shuffle( $this->data ); } private function links( array $items ) { $links = array(); foreach ( $items as $item ) { $links[] = $item->link; } return $links; } } /********* Feeds *********/ $urls = array('http://www.dallascowboys.com/rss/video', 'http://www.dallascowboys.com/rss/gallery', 'http://www.dallascowboys.com/rss/audio', 'http://espn.go.com/blog/feed?blog=nfceast', 'https://sports.yahoo.com/nfl/teams/dal/rss.xml',); /********* Feeds *********/ try { $feeds = new Feed_Amalgamator; $feeds->addFeeds( $urls ); $feeds->grabRss(); $feeds->amalgamate(); } catch ( exception $e ) { die( $e->getMessage() ); } foreach ( $feeds->data as $item ) : extract( (array) $item ); $truncated = (strlen($description) > 100) ? substr($description, 0, 80) . '...' : $description; and it's working quite nicely... however I'm trying to replace the actual feeds them selves in this section: /********* Feeds *********/ $urls = array('http://www.dallascowboys.com/rss/video', 'http://www.dallascowboys.com/rss/gallery', 'http://www.dallascowboys.com/rss/audio', 'http://espn.go.com/blog/feed?blog=nfceast', 'https://sports.yahoo.com/nfl/teams/dal/rss.xml',); /********* Feeds *********/ with this: /********* Feeds *********/ $urls = array($params->get('url')); /********* Feeds *********/ But I keep getting this: String could not be parsed as XMLI know it's reading the links but it doesn't seem to be passing them correctly to be parsed for some reason... Suggestions? Thanks in advance!
×
×
  • 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.