Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/07/2013, 16:50
Avatar de rhasert
rhasert
 
Fecha de Ingreso: febrero-2008
Mensajes: 47
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Modulo para joomla streams

Me gustaria modificar este codigo fuente:
Código PHP:
<?php
echo '<b>StarCraft 2</b> &nbsp; </br>';    
    
defined('_JEXEC') or die('Direct access to this location is not allowed.');
    
    
    
//get's the comma seperated list from the module manager page
    
$userList $params->get('userlist');
    
// This variable becomes one long url with the channel names stringed up behind it
// This url then fetches a json file from twitch with all the selected channels information
    
$usersArray explode(','$userList);
    
//grabs the channel data from twitch.tv streams    
    
$userGrab "http://api.justin.tv/api/stream/list.json?channel=";
    
$checkedOnline = array ();
    
        
//creates a url for retrieving the twitch json file for our selected users
    
foreach($usersArray as $i =>$value){
        
$userGrab .= ",";
        
$userGrab .= $value;
    }
    unset(
$value); 
    
//grabs the channel data from our teams twitch.tv streams using the $userGrab url
    
$json_file file_get_contents($userGrab0nullnull);

//decodes the jason file and turns it into an array
    
$json_array json_decode($json_filetrue);
    
//get's member names from stream url's and checks for online usersArray
    
foreach($usersArray as $i =>$value){
        
$title $json_array[$i]['channel']['channel_url'];
        
$array explode('/'$title);
        
$member end($array);
        
$viewer $json_array[$i]['stream_count'];
        
$topic $json_array[$i]['title'];
        
onlinecheck($member$viewer$topic);
        
$checkedOnline[] = signin($member);
    }

    unset(
$value);
    unset(
$i);

//checks if player streams are online    
    
function onlinecheck($online$viewers$topic)
    {  
//If the variable online is not equal to null, there is a good change this person is currently streaming    
        
if ($online != null)
            {
                    echo 
'<a href="http://www.twitch.tv/'.$online.'"> <strong>'.$online.'</strong></a>'
                           echo 
'&nbsp; </br>';
                           
//echo '<strong>'.$topic.'</strong> </br>';
            
}
    }
    
//This funcion add's online channel names to the checked online array    
    
function signin($person){
    if(
$person != null){
        return 
$person;
    }
    else{
        return 
null;
    }
}
?>
Para que yo le diera los valores en el codigo meterlos en el array y me diga si el usuario esta online, y si es asi que aparezca su nombre con el link a la web, y que el html fuera parecido a esto

Cita:
StarCraft: Brood War
snipealot2
Metal[x]
StarCraft 2
Dragon
ProTech
Dota 2
Wagamama
Merlini
EG.DeMoN
Funn1k
Other Notable Streams
Destiny
itmeJP
Draskyl
PainUser
Los usuarios son el ejemplo sacado de teamliquid.net Generalmente es lo que quiero hacer, y que al hacer clik en uno me lleve a la pagina de su stream pero dentro del joomla, como teamliquid mas o menos. Toy creando una pagina para campeonatos y necesito poner los stream.

Muchas gracias a todos
__________________
Tu Hosting [URL="http://starbound-esp.com[/URL]