Jump to content

cowboysdude

Members
  • Posts

    123
  • Joined

  • Last visited

About cowboysdude

  • Birthday 02/22/1963

Profile Information

  • Gender
    Male
  • Location
    Upstate NY

cowboysdude's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. 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!!
  2. 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!
  3. 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...
  4. 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!!!
  5. $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.
  6. 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!
  7. That all makes sense!! Huge Thank you!!! Problem is I tend to make it harder then it has to be... LOL Again, Thank you!
  8. 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....
  9. 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>
  10. 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
  11. 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 )
  12. 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!
  13. I'm working on this module and so far so good BUT I would like to be able to highlight the higher score and for some reason I'm having an issue with it... It's more of an else statement issue... Here is what I have.... if ($game['q'] == 'P') { ?> <li><div class=box-blue> <?= $game['d'] ?> | <?= $datey ?> | <?= $game['t'] ?></div> <?= $homeTeam ?> <?= $game['hs'] ?> <br /> <?= $visitingTeam ?> <?= $game['vs'] ?> <br /> <div class=box-blue> Game Temp: <?= $current ?>° Condition: <?= $condition ?> </div></li> <?php } else { ?> <li><?= $homeTeam ?> <?= $game['hs'] ?> <br /><?= $visitingTeam ?> <?= $game['vs'] ?> <br /> <div class=box-blue> <?php if ($game['q'] == "F") {?>Final<?php } ?> <?php if ($game['q'] == "FO") {?>Final Overtime<?php }?> <?php if ($game['q'] == "H") {?>Half Time<?php }?> <?php if ($game['q'] == "1") {?>1st Quarter<?php } ?> <?php if ($game['q'] == "2") {?>2nd Quarter<?php } ?> <?php if ($game['q'] == "3") {?>3rd Quarter<?php } ?> <?php if ($game['q'] == "4") {?>4th Quarter<?php } ?> <?php if ($game['q'] == "T") {?>Tie<?php }?> <?= $game['k'] ?> </div></li> <?php } What I tried to add was this.. If( $game['hs'] > $game['vs'] ){ ?> <li><?= $homeTeam ?> <font color=red><?= $game['hs'] ?></font> <br /><?= $visitingTeam ?> <?= $game['vs'] ?> <br /> <div class=box-blue> <?php if ($game['q'] == "F") {?>Final<?php } else {?> <li><?= $homeTeam ?> <?= $game['hs'] ?> <br /><?= $visitingTeam ?> <font color=red><?= $game['vs'] ?></font> <br /> <div class=box-blue> <?php if ($game['q'] == "F") {?>Final<?php } But when I do I get an else error... what am I missing here? I thought this would be pretty easy... Thank yoU!
  14. WINNER! Thank you so much... this is what worked print_r ($phpObj[query][results][channel][image][url]); Thank you sir!
  15. This is the json data I have and I'm trying to get the info out of it but for some reason I am having great difficulty doing so.... array(1) { ["query"]=> array(4) { ["count"]=> int(1) ["created"]=> string(20) "2015-12-11T19:32:29Z" ["lang"]=> string(5) "en-US" ["results"]=> array(1) { ["channel"]=> array(13) { ["title"]=> string(27) "Yahoo! Weather - Elmira, NY" ["link"]=> string(106) "http://us.rd.yahoo.com/dailynews/rss/weather/Elmira__NY/*http://weather.yahoo.com/forecast/USNY0463_f.html" ["description"]=> string(29) "Yahoo! Weather for Elmira, NY" ["language"]=> string(5) "en-us" ["lastBuildDate"]=> string(28) "Fri, 11 Dec 2015 1:52 pm EST" ["ttl"]=> string(2) "60" ["location"]=> array(3) { ["city"]=> string(6) "Elmira" ["country"]=> string(13) "United States" ["region"]=> string(2) "NY" } ["units"]=> array(4) { ["distance"]=> string(2) "mi" ["pressure"]=> string(2) "in" ["speed"]=> string(3) "mph" ["temperature"]=> string(1) "F" } ["wind"]=> array(3) { ["chill"]=> string(2) "59" ["direction"]=> string(3) "230" ["speed"]=> string(2) "12" } ["atmosphere"]=> array(4) { ["humidity"]=> string(2) "55" ["pressure"]=> string(4) "29.8" ["rising"]=> string(1) "0" ["visibility"]=> string(2) "10" } ["astronomy"]=> array(2) { ["sunrise"]=> string(7) "7:24 am" ["sunset"]=> string(7) "4:34 pm" } ["image"]=> array(5) { ["title"]=> string(14) "Yahoo! Weather" ["width"]=> string(3) "142" ["height"]=> string(2) "18" ["link"]=> string(24) "http://weather.yahoo.com" ["url"]=> string(58) "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif" } ["item"]=> array(9) { ["title"]=> string(40) "Conditions for Elmira, NY at 1:52 pm EST" ["lat"]=> string(5) "42.09" ["long"]=> string(6) "-76.81" ["link"]=> string(106) "http://us.rd.yahoo.com/dailynews/rss/weather/Elmira__NY/*http://weather.yahoo.com/forecast/USNY0463_f.html" ["pubDate"]=> string(28) "Fri, 11 Dec 2015 1:52 pm EST" ["condition"]=> array(4) { ["code"]=> string(2) "34" ["date"]=> string(28) "Fri, 11 Dec 2015 1:52 pm EST" ["temp"]=> string(2) "59" ["text"]=> string(4) "Fair" } This is what I have so far but for some reason I cannot seem to get it to work... $BASE_URL = "http://query.yahooapis.com/v1/public/yql"; $yql_query = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="elmira, ny")'; $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json"; // Make call with cURL $session = curl_init($yql_query_url); curl_setopt($session, CURLOPT_RETURNTRANSFER,true); $json = curl_exec($session); // Convert JSON to PHP object $phpObj = json_decode($json, true); // foreach($phpObj['data']['weather'] as $item) { echo "<pre>"; var_dump($phpObj); echo "</pre>"; //echo $phpObj->results->channel->image->url; I would like to get the image url and have tried several ways but no go... suggestions? Thanks in advance! John
×
×
  • 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.