Fork me on GitHub

Rapport de message :*
 

Re: Utiliser l'api allociné dans xoopstube

Titre du sujet : Re: Utiliser l'api allociné dans xoopstube
par seboseboss sur 31/12/2014 10:53:07

Salut

Alors c'est tout bon, j'ai solutionné tout les problèmes d'accent, de ponctuation, mais il reste 1 chose que je ne comprend pas, c'est pourquoi ma variable $nom_genre ne veut pas s'afficher en autocomplétion alors qu'elle s'affiche pour la description.

J'avais réussi à l'afficher l'autre jour mais plus moyen.
l'écriture normale ne fonctionne pas.
//récupération infos allociné et autocompletion
    
require_once XOOPS_ROOT_PATH '/api-allocine/api-allocine-helper.php';
    
   
// Créer l'objet
    
$helper = new AlloHelper;

    
//Pour plus de clareté, on définit les paramètres à l'avance: le code du film, et la quantité d'informations à récupérer.

    
$code $_POST['filmcode'];
    
$profile 'medium';
    
    
//Ensuite, il est conseillé d'effectuer des requêtes dans un bloc try{} catch(){} pour gérer les erreurs.
if(isset($_POST['filmcode'])) {
    try
    {
        
// Envoi de la requête
        
$data $helper->movie$code$profile$filter );
        
//print_r($data->getArray());
        
        //Convertir la durée en hh:mm:ss
        
$total $data->runtime//Nombre de secondes
        
$heure intval(abs($total 3600));
        
$total $total - ($heure 3600);
        
$minute intval(abs($total 60));
        
$total $total - ($minute 60);
        
$seconde $total;
        
        
//Convertir la date en jj.mm.aa
        
$date $data->release['releaseDate'];
        function 
datefr($date) { 
        
$split split("-",$date); 
        
$annee $split[0]; 
        
$mois $split[1]; 
        
$jour $split[2]; 
        return 
"$jour"."-"."$mois"."-"."$annee"


        
$date $data->release['releaseDate'];; // Date format américain
        // $date=date("Y-m-d"); // Ou date du jour

    
}
    catch( 
ErrorException $error )
    {
        
// En cas d'erreur
        
echo "Erreur n°"$error->getCode(), ": "$error->getMessage(), PHP_EOL;
    }
    
    
    
$url_img $xtubemyts->addslashes(ltrim($data->poster));
    
$titre $xtubemyts->addslashes(ltrim($data->title));
    
$annee $xtubemyts->addslashes(ltrim($data->productionYear));
    
$duree $xtubemyts->addslashes(ltrim($data->runtime));
    
$date_sortie $xtubemyts->addslashes(ltrim($data->release['releaseDate']));
    
$nom_realisateur $xtubemyts->addslashes(ltrim($data->castingShort['directors']));
    
$synopsis $xtubemyts->addslashes(ltrim($data->synopsis));
    
$nom_acteur $xtubemyts->addslashes(ltrim($data->castingShort['actors']));
    
$nom_pays $xtubemyts->addslashes(ltrim($data->nationality[0]['$']));
    
$bande_a $xtubemyts->addslashes(ltrim($data->trailerEmbed));
    
$nom_genre $xtubemyts->addslashes(ltrim($data->genre[0]['$']));
    
    function 
removespace($nom_genre)
        {
        
$spaced = array("Arts Martiaux","Comédie dramatique","Comédie musicale","Science fiction");
        
$nonspaced = array("Arts-Martiaux","Comédie-dramatique","Comédie-musicale","Science-fiction");

        
$nom_genre str_replace($spaced$nonspaced$nom_genre);

        return 
$nom_genre;
        }
    
$nom_genre removespace($nom_genre);
    
    
$descrip '' $data->synopsis .'<br /><br />Date de production ' $data->productionYear '('.$heure.'h'.$minute.'min)<br />Réalisé par ' $nom_realisateur '<br />Avec ' $nom_acteur '<br />Genre ' $nom_genre '<br />Nationalité ' $nom_pays '<br /><img src="' $data->poster '" style="width: 190px; height: 260px;"></img><br />' $data->trailerEmbed '';
}
       
$sql         'SELECT * FROM ' $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' intval($lid);
        
$video_array $xoopsDB->fetchArray($xoopsDB->query($sql));

        
$lid          $video_array['lid'] ? $video_array['lid'] : 0;
        
$cid          $video_array['cid'] ? $video_array['cid'] : 2;
        
$title        $video_array['title'] ? $xtubemyts->htmlSpecialChars($video_array['title']) : $xtubemyts->htmlSpecialChars($data->title).' [FilmFR]';
        
$vidid        $video_array['vidid'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['vidid']) : '';
        
$publisher    $video_array['publisher'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['publisher']) : '';
        
$screenshot   $video_array['screenshot'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['screenshot']) : '';
        
$descriptionb $video_array['description'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['description']) : ''.$descrip.'';
        
$published    $video_array['published'] ? $video_array['published'] : 0;
        
$expired      $video_array['expired'] ? $video_array['expired'] : 0;
        
$updated      $video_array['updated'] ? $video_array['updated'] : 0;
        
$offline      $video_array['offline'] ? $video_array['offline'] : 0;
        
$vidsource    $video_array['vidsource'] ? $video_array['vidsource'] : 0;
        
$ipaddress    $video_array['ipaddress'] ? $video_array['ipaddress'] : 0;
        
$notifypub    $video_array['notifypub'] ? $video_array['notifypub'] : 0;
        
$vidrating    $video_array['vidrating'] ? $video_array['vidrating'] : 1;
        
$time         $video_array['time'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['time']) : ''.$heure.'h'.$minute.'min';
        
$keywords     $video_array['keywords'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['keywords']) : '';
        
$item_tag     $video_array['item_tag'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['item_tag']) : ''.$nom_genre.'';
        
        
$picurl       $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : '';


Je l'utilise dans la variable $descr et elle s'affiche bien en autocomplétion dans la description.

L'autre jour j'avais réussi à l'afficher mais en écrivant différement, pas comme il faudrait faire. c'est bizare et j'ai pâs réussi a le refaire.

Si tu a une idée du pourquoi du comment, je suis prenneur.
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

42 Personne(s) en ligne (33 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 42 | Plus ...