开发者

Not sure how to link json 100% in php

Im tryi开发者_Python百科ng to create an rss feed that my droid app reads but i have some holes that i can figure how to fix the json link page is http://www.mandarich.com/mandarichServer/mlb/indexbaseball.php when reading the json i can see where the icon is missing on some and cant figure out why. mainly only for citys like ney york and chicago(cities with two names) and the code i have for the php is as follows:

<?php

$teams["boston"] = "bostonredsox.gif";
$teams["nyyankees"] = "nyyankees.gif";
$teams["baltimore"] = "baltimoreorioles.gif";
$teams["tampa"] = "tampabayrays.gif";
$teams["toronto"] = "torontobluejays.gif";
$teams["atlanta"] = "atlantabraves.gif";
$teams["florida"] = "floridamarlins.gif";
$teams["nymets"] = "newyorkmets.gif";
$teams["philadelphia"] = "philadelphiaphillies.gif";
$teams["washington"] = "washingtonnationals.gif";
$teams["chicagosox"] = "chicagowhitesox.gif";
$teams["cleveland"] = "clevelandindians.gif";   
$teams["detroit"] = "detroittigers.gif";
$teams["kansas"] = "kansascityroyals.gif";
$teams["minnesota"] = "minnesotatwins.gif";
$teams["chicagocubs"] = "chicagocubs.gif";
$teams["cincinnati"] = "cinncinatireds.gif";
$teams["houston"] = "houstonastros.gif";
$teams["milwaukee"] = "milwaukeebrewers.gif";
$teams["pittsburgh"] = "pitsburghpirates.gif";
$teams["St.Louis"] = "stlouiscardinals.gif";
$teams["LaAngels"] = "losangelesangels.gif";
$teams["oakland"] = "oaklandathletics.gif";
$teams["seattle"] = "seattlemariners.gif";
$teams["texas"] = "texasrangers.gif";
$teams["arizona"] = "arizonadiamondbacks.gif";
$teams["colorado"] = "coloradorockies.gif";
$teams["ladodgers"] = "losangelesdodgers.gif";
$teams["sandiego"] = "sandiegopadres.gif";
$teams["sanfrancisco"] = "sanfranciscogiants.gif";


$abbr["arizona"] = "ARI";
$abbr["oakland"] = "OAK";
$abbr["baltimore"] = "BAL";
$abbr["tampa"] = "TAM";
$abbr["boston"] = "BOS";
$abbr["nyyankees"] = "NYY";
$abbr["texas"] = "TEX";
$abbr["toronto"] = "TOR";
$abbr["LaAngels"] = "LAA";
$abbr["atlanta"] = "ALT";
$abbr["colorado"] = "COL";
$abbr["philadelphia"] = "PHI";  
$abbr["florida"] = "FLA";
$abbr["milwaukee"] = "MIL";
$abbr["washington"] = "WAS";
$abbr["chicagosox"] = "CHW";
$abbr["cleveland"] = "CLE";
$abbr["detroit"] = "DET";
$abbr["seattle"] = "SEA";
$abbr["sanfrancisco"] = "SFO";
$abbr["St.Louis"] = "STL";
$abbr["chicagocubs"] = "CHC";
$abbr["houston"] = "HOU";
$abbr["nymets"] = "NYM";
$abbr["cincinnati"] = "CIN";
$abbr["sandiego"] = "SDG";
$abbr["ladodgers"] = "LAD";
$abbr["pittsburgh"] = "PIT";
$abbr["minnesota"] = "MIN";
$abbr["kansas"] = "KAN";
?>


St. Louis is st.louis in $abbr and stlouis in $teams. That's likely what's causing that problem.

As for some of them showing up and some not, I'll bet that your problem is that you're using team1 and team2 to look up what the images are. If that's the case, then you've got capital/lowercase issues. Make everything lowercase. On top of that, you've got spaces in team*, which would cause issues. So instead of la dodgers, try ladodgers.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜