0
I have a list of channel names that are broadcasting a certain game on twitch.tv (api)
, so I can take all the channels and list the same.
The question is how to put them in a div
To stay in blocks horizontally (as in the image) and also that when it reached 4 blocks (div´s)
, jump to the bottom line.
<?php
$api2 = file_get_contents("https://api.twitch.tv/kraken/search/streams?client_id=g5ynk8n0llmefg9m70ruyg36bbt6si&query=fifa17&limit=100");
$defuse = json_decode($api2);
if($defuse == null){
echo "erro";
}else{
$total_lives=$defuse->_total;
echo "Toltal de Lives: ".$total_lives."</br>";
foreach($defuse->streams as $v)
echo "Nome do Canal: ".$v->channel->name."</br>";
}
?>
It didn’t work out buddy I wanted to make each name would stick and a div in this way you spoke only got one div and not the other 99, wanted that each result of the foreach would be with a div
– Thainan Esteves
Look then PHP has been integrated in the wrong way. Foreach has to stay out of the div and echo inside it. Each time you go through the loop it generates the div. I’ll even edit the answer for you to see
– Fabri Damazio
Opa buddy I managed to solve thanks to your help thank you
– Thainan Esteves
I’m glad it worked out!
– Fabri Damazio