Index du forum »»  Le coin des codeurs »» pourquoi j'ai le nom du fichier dans le bloc?

pourquoi j'ai le nom du fichier dans le bloc?#21990

2Contributeur(s)
jpbleloup31
3 Modérateur(s)
developpeurjpbJireck
jpb jpbicon_post

<?php
$dev_id 
"HSkI3UPljNU";// request your DEV_ID at http://www.youtube.com/signup?next=my_profile_dev
$account = 
"jipexu";//your youtube account name 


$stream=file_get_contents(
"http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=$dev_id&user=$account");//get the xml file

//mise en tableau
preg_match_all('#<id>(.*?)</id>#',$stream,$regs); ;
$array_id=$regs
[1];
     
srand ((double) microtime() * 10000000); // for old php...
$vid_ran = array_rand ($array_id, 3);//the second parameter 
for($i=0; $i<count($vid_ran); $i++)
{
$id_ran=$vid_ran
[$i];
$content.=
"<object width=\"200\" height=\"150\" title=\"Watch...\"><param name=\"movie\" value=\"http://www.youtube.com/v/$array_id[$id_ran]\"></param><param name=\"wmode\" value=\"transparent\"></param><!embed! src=\"http://www.youtube.com/v/$array_id[$id_ran]\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"200\" height=\"150\"></!embed!></object><br />";
}
?>


leloup31 leloup31icon_post
Tu devrais en dehors de ta boucle for initialiser $content à vide.

:-P
jpb jpbicon_post


<?php
if(!isset($mainfile)) { !include!("mainfile.php"); }
global $pdst; $pdst=1;  
!include! ('header.php');

$dev_id = 
"HSkI3UPljNU";// request your DEV_ID at http://www.youtube.com/signup?next=my_profile_dev
$account = 
"jipexu";//
$incrementby=3;


$stream=file_get_contents(
"http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=$dev_id&user=$account");

//mise en tableau
preg_match_all('#<id>(.*?)</id>#',$stream,$regs); ;
$array_id=$regs
[1];
preg_match_all('#<author>(.*?)</author>#',$stream,$regs);
$array_author=$regs
[1];
preg_match_all('#<title>(.*?)</title>#',$stream,$regs);
$array_title=$regs
[1];
preg_match_all('#<length_seconds>(.*?)</length_seconds>#',$stream,$regs);
$array_length_seconds=$regs
[1];
preg_match_all('#<rating_avg>(.*?)</rating_avg>#',$stream,$regs);
$array_rating_avg=$regs
[1];
preg_match_all('#<rating_count>(.*?)</rating_count>#',$stream,$regs);
$array_rating_count=$regs
[1];
preg_match_all('#<description>(.*?)</description>#',$stream,$regs);
$array_description=$regs
[1];
preg_match_all('#<view_count>(.*?)</view_count>#',$stream,$regs);
$array_view_count=$regs
[1];
preg_match_all('#<upload_time>(.*?)</upload_time>#',$stream,$regs);
$array_upload_time=$regs
[1];
preg_match_all('#<comment_count>(.*?)</comment_count>#',$stream,$regs);
$array_comment_count=$regs
[1];
preg_match_all('#<tags>(.*?)</tags>#',$stream,$regs);
$array_tags=$regs
[1];
preg_match_all('#<url>(.*?)</url>#',$stream,$regs);
$array_url=$regs
[1];
preg_match_all('#<thumbnail_url>(.*?)</thumbnail_url>#',$stream,$regs);
$array_thumbnail_url=$regs
[1];
$input = array (
"Neo""Morpheus""Trinitée""Cypher""Tank");

$nb_video=count($array_id);

function random_bloc() 
{
global $array_id;
srand ((double) microtime() * 10000000);
$video_ran = array_rand ($array_id, 3);
$content.=
"<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/$video_ran\"></param><param name=\"wmode\" value=\"transparent\"></param><!embed! src=\"http://www.youtube.com/v/$video_ran\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></!embed!></object>";
return ($content);
};

/////////////////////////////////////////////////////////////////
/
//////////////////////mise en forme date
for($i=0; $i<count($array_upload_time) ; $i++) 
{
$b .=strftime ( 
"%A %e %B %Y, %r_" ,$array_upload_time[$i]);
 
};
$array_upload_time=preg_split ('#_#',$b);
//////////////////////mise en forme date





for($i=0; $i<$nb_video ; $i++)
    
{$affichage.="<tr><td>
    <strong>
".translate("Author")." : </strong>".preg_replace('#jipexu#',"Jean Pierre Barbary",$array_author[$i])."<br/>
    <strong>
".translate("Title:")." </strong>$array_title[$i]<br />
    <strong>Dur&#xE9;e : </strong>$array_length_seconds
[$i]<br />
    <strong>Moyenne vote : </strong>$array_rating_avg
[$i]<br />
    <strong>
".translate("Votes: ")."</strong>$array_rating_count[$i]<br />
    <strong>Description : </strong>$array_description
[$i]<br />
    <strong>Vu : </strong>$array_view_count
[$i]<br />
    <strong>Date de mise en ligne : </strong>$array_upload_time
[$i]<br />
    <strong>
".translate("Comment")." : </strong>$array_comment_count[$i]<br />
    <strong>Mots clef : </strong>$array_tags
[$i]<br />
    <a href=
\"$array_url[$i]\" title=\"Voir la video sur le site web de youtube,  channel Travel in chinese earth\">Voir</a><br/
    <img src =
\"$array_thumbnail_url[$i]\" title=\"$array_title[$i]\" alt=\" $array_title[$i] : $array_description[$i]\">
    
   <br /></td><td><object width=
\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/$array_id[$i]\"></param><param name=\"wmode\" value=\"transparent\"></param><!embed! src=\"http://www.youtube.com/v/$array_id[$i]\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></!embed!></object><br /></td></tr> ";
    
} 
echo 
"<div class=\"titrgkc\">Vid&#xE9;os [$nb_video]</div><br /><hr />please be cool on work...<table>
<table border=
\"1\">
$affichage
</table>
<br />$nav_block
";
!include! ('footer.php');
/////////////////////////////////////////////////////////////////

?>