Skip to content

Help with Extenison Widget #135

Answered by svilenmarkov
DickenSerm asked this question in Q&A
Discussion options

You must be logged in to vote

Yup, that looks correct. The parameters are completely optional and are only there for convenience, you don't need to use them and can do everything within the PHP script. They are useful if you want to reuse the same script with different parameters, for example if you modify the top part of the script to this:

<?php
$year = $_GET['year'] ?? '2024';
$teamsLimit = $_GET['teams-limit'] ?? 3;

$body = file_get_contents('https://api.openligadb.de/getavailableteams/bl1/' . $year);
$json = json_decode($body, true);
$teams = array_slice($json, 0, $teamsLimit);

header('Widget-Title: Teams ' . $year);
header('Widget-Content-Type: html');
?>

You can now reuse the extension and have it display dif…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by DickenSerm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants