Displaying matches
A complete list of parameters is available at the bottom of the page but the best way to get started is probably to go through the examples below.
Example 1 - Select a league
In the simplest case you only need to specify one parameter: what league to display. For that you need a league-id. Here's a complete list of the leagues in SoccerDB and their id:s. In this example we're using English Premier League 2007/08 which has id 391.
Add the following line to your page where you want to display the matches:
<script type="text/javascript"
src="http://www.aragon.ws/soccerdb/getmatches.php?id=391"></script>
This will display the matches for the current week:
Example 2 - Specify date
The date
-parameter is used to specify what matches to display. It can be one of the value latest
, next
or a date on the format YYYY-MM-DD.
latest
displays the most recently played matches, next
displays upcoming fixtures and if you specify a date you'll get the matches for that week.
If you don't specify the date parameter at all the matches for the current week will be displayed.
Example code - display latest matches:
<script type="text/javascript"
src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=latest"></script>
Result:
Example code - display next matches:
<script type="text/javascript"
src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=next"></script>
Result:
Example 3 - Styles
To control the style of the displayed matches you can use CSS-classes. Use the parameter css
to name the class you want to use for the main data in the match listing.
The parameter cssDate
is used for rows containing dates.
If you view the source of this page you can see how the classes are defined in a <style>-tag. You can also define the classes in a separate stylesheet.
Example code:
<script type="text/javascript"
src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=2008-02-04
&css=Match&cssDate=Date"></script>
Result:
Example 4 - Highlight a team
If you want to highlight your favorite team you can set the parameter highlightTeam. For that you need a team-id.
You also need to set cssHighlight
to specify the CSS-class used to highlight the team.
Example code:
<script type="text/javascript" src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=2008-02-04
&highlightTeam=24&css=Match&cssDate=Date&cssHighlight=Highlight"></script>
Result:
Example 5 - Format the dates
By default dates are displayed on the format YYYY-MM-DD. You can change this by using the parameter dateFormat
.
On this page you can see what formats are available.
If you want to use a format like "Sunday 10 February" the format string would be: %A %d %B
.
To complicate things a little you need to urlencode the string before you put it as a parameter on the url. In this case we need to change % to %25 and spaces to %20.
So the urlencoded string would be: %25A%20%25d%20%25B
.
Example code:
<script type="text/javascript" src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=2008-02-04
&css=Match&cssDate=Date&dateFormat=%25A%20%25d%20%25B"></script>
Result:
Parameters
The only parameter that must be specified is id
, all the others are optional. The first parameter should be proceeded by a ? and the following parameters are separated using the character &.
Example:
<script type="text/javascript" src="http://www.aragon.ws/soccerdb/getmatches.php?id=391&date=2008-02-04
&highlightTeam=24&css=Match&cssDate=Date&cssHighlight=Highlight"></script>
Name | Description |
id | The id of the league. Here's a list of all available leagues in SoccerDB. |
date |
The date -parameter is used to specify what matches to display. It can be one of the value latest , next or a date on the format YYYY-MM-DD.
latest displays the most recently played matches, next displays upcoming fixtures and if you specify a date you'll get the matches for that week.
If you don't specify the date parameter at all the matches for the current week will be displayed.
|
css | The name of the CSS class to use for the main table rows. |
cssDate | Specify the CSS class of the date rows. |
highlightTeam | Highlights a team. You need to specify a team-id which you can find here. |
cssHighlight | The CSS class used to display the team selected in highlightTeam . |
dateFormat | Specifies the format to use for dates. See this page for available formats. Note that the format string need to be urlencoded. |