-
-
Save jaubourg/430229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
## Nav data, as a JSON heredoc. Much less verbose than PHP arrays! | |
$navs = json_decode(<<<JSON | |
{ | |
"mlb": { | |
"title_link": "http://stats.boston.com/mlb/scoreboard.asp", | |
"nav": [ | |
{ "title": "Full Schedule", "url": "http://stats.boston.com/mlb/teamreports.asp?tm=02&report=schedule" }, | |
{ "title": "Statistics", "url": "http://stats.boston.com/mlb/teamreports.asp?yr=2009&tm=2&btnGo=Go&report=stats" }, | |
{ "title": "Standings", "url": "http://stats.boston.com/mlb/standings.asp" } | |
] | |
}, | |
"nfl": { | |
"title_link": "http://stats.boston.com/fb/scoreboard.asp", | |
"nav": [ | |
{ "title": "Full Schedule", "url": "http://stats.boston.com/fb/teamstats.asp?yr=2009&tm=17&btnGo=Go&type=schedules" }, | |
{ "title": "Statistics", "url": "http://stats.boston.com/fb/teamstats.asp?teamno=17&type=stats" }, | |
{ "title": "Standings", "url": "http://stats.boston.com/fb/totalstandings.asp" }, | |
{ "title": "Season timeline", "url": "http://timelines.boston.com/patriots" } | |
] | |
}, | |
"nhl": { | |
"title_link": "http://stats.boston.com/nhl/scoreboard.asp", | |
"nav": [ | |
{ "title": "Full Schedule", "url": "http://stats.boston.com/nhl/teamstats.asp?teamno=01&btnGo=Go&type=schedule" }, | |
{ "title": "Statistics", "url": "http://stats.boston.com/nhl/teamstats.asp?teamno=01&btnGo=Go&type=stats" }, | |
{ "title": "Standings", "url": "http://stats.boston.com/nhl/standings_conference.asp" }, | |
{ "title": "Season timeline", "url": "http://timelines.boston.com/bruins#/seasons/2009" } | |
] | |
}, | |
"nba": { | |
"title_link": "http://stats.boston.com/nba/scoreboard.asp", | |
"nav": [ | |
{ "title": "Full Schedule", "url": "http://stats.boston.com/nba/teamstats.asp?teamno=02&btnGo=Go&type=schedule" }, | |
{ "title": "Statistics", "url": "http://stats.boston.com/nba/teamstats.asp?teamno=02&btnGo=Go&type=totstats" }, | |
{ "title": "Standings", "url": "http://stats.boston.com/nba/standings_conference.asp" }, | |
{ "title": "Season timeline", "url": "http://timelines.boston.com/celtics" } | |
] | |
} | |
} | |
JSON | |
, true); | |
## Get nav data | |
$nav =& $navs[ $_GET['league'] ? strtolower( $_GET['league'] ) : 'all' ]; | |
## Output. | |
?><div class="scorebelt"> | |
<div class="scorebelt-nav"> | |
<? if ( $nav['title_link'] ): ?> | |
<h3><a href="<?= $nav['title_link'] ?>">Scoreboard</a></h3> | |
<? else: ?> | |
<h3>Scoreboard</h3> | |
<? endif; ?> | |
<ul> | |
<? foreach ( $nav['nav'] as $item ): ?> | |
<li><a href="<?= $item['url'] ?>"><?= $item['title'] ?></a></li> | |
<? endforeach; ?> | |
</ul> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment