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 montuy337513 sur 03/01/2015 21:43:00

Citation :

Note:
Pas pratique ces balises code, on ne peut pas naviguer de droite à gauche ou vice versa sans aller tout en bas, du coup c'est vraiment galère de lire le code quand il s'agit d'un grand fichier.
Faudrait pouvoir faire défiler en restant appuyé sur clic gauche ou que la barre de défilement retse collé en bas de page tant qu'ont est pas en bas.
Vous vous en foutez je parie.(bon ben tant pis pour moi)


Non, non, je ne m'en fous pas, j'en prend note, je suis justement occupé à préparer la nouvelle version du site, donc je note, c'est une remarque pertinente.

Sinon, ma ligne t'affiche ce genre de message, c'est que le tableau $video_array n'existe pas.

Et si var_dump ne t'affiche rien, effectivement, c'est qu'il y a un problème

déjà je suis perplexe par ce bout de code
$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']) : '' $xoopsUser->getVar('uname') . '';
        
$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 ne me souvient plus ce que retourne la class xoopsDB pour cette fonction (j'utilise les miennes via PDO)
$video_array $xoopsDB->fetchArray($xoopsDB->query($sql));

ici en théorie tu devrais avoir un tableau en retour

mais de la forme
$video_array[0] -> première ligne
$video_array[1] -> seconde ligne
etc...

donc en théorie pour la première ligne (ou si tu est sûr qu'il n'y aura qu'un résultat)
if(is_array($video_array) && count($video_array) > 0){ // On teste si c'est un tableau et si il y a au moins 1 resultat
$lid = (array_key_exists('lid',$video_array[0])) ? $video_array[0]['lid'] : 0
.
.
.
}else{
$lid 0;
.
.
.
}

[/code]
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

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