Displaying tables
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 the table:
<script type="text/javascript"
src="http://www.aragon.ws/soccerdb/gettable.php?id=391"></script>
And you will get a table looking like this:
Example 2 - Styles
In this example we've added a few parameters to control the style of the table. First there's a parameter called showHeader
which specifies that the table should contain a header row. Then there are four parameters that specifies the name of CSS-classes for different parts of the table. cssHeader
is for the header, cssLines
for the table lines, and css1
and css2
for the main table rows. 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/gettable.php?id=391&showHeader=true
&cssHeader=header&cssLines=lines&css1=odd&css2=even"></script>
Result:
Example 3 - Highlight a team
To make your favorite team stand out in the table 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/gettable.php?id=391&cssLines=lines
&css1=odd&css2=even&highlightTeam=24&cssHighlight=highlight"></script>
Result:
Example 4 - Limit the number of teams
If the space on your page is limited and you don't want to display the full table you can use the parameter numberOfTeams
to specify how many teams the table should contain. If you also specify highlightTeam
the table will be centered around that team otherwise the top of the table will be displayed.
Example code:
<script type="text/javascript" src="http://www.aragon.ws/gettable.php?
id=391&cssLines=lines&css1=odd&css2=even&highlightTeam=24
&cssHighlight=highlight&numberOfTeams=5"></script>
Result:
Example 5 - Select columns
You can also specify what columns to display using the parameter columns
. See the parameter section for the complete syntax of this parameter.
This example shows position, team name, and points:
<script type="text/javascript" src="http://www.aragon.ws/gettable.php?
id=391&cssLines=lines&css1=odd&css2=even&columns=pos,team,pts"></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/gettable.php?id=41&cssLines=lines
&css1=odd&css2=even&highlightTeam=14&cssHighlight=highlight"></script>
Name | Description |
id | The id of the league. Here's a list of all available leagues in SoccerDB. |
css1 | The name of the CSS class to use for the main table rows. Can be used together width css2 to create a table with rotating colors. If you don't want that set css1 and css2 to the same value. |
css2 | see above |
cssLines | The CSS class of the table lines. Specify the background-color element for this class to make the table lines a certain color. |
showHeader | Set to true if you want a row with headers above the table. |
cssHeader | Specify the CSS class of the header row. |
highlightTeam | Highlights a team in the table. You need to specify a team-id which you can find here. |
cssHighlight | The CSS class used to display the team selected in highlightTeam . |
numberOfTeams | The number of teams the table should contain. If highlightTeam is also specified the table will be centered around that team, otherwise the top of the table will be displayed. |
columns | Specifies what columns the table should contain. The value should be a comma-separated list of column names. The following column names can be used:
columns=pos,team,pts to make a table that displays position, team name, and points.
|