Problème paramètrage $phpbb_root_path

Bonjour,

j'ai créé (avec pas mal d'aide car je ne suis pas très bon) un fichier permettant d'afficher de façon aléatoire (sur la base d'une liste) des vidéo sur une page de mon site.

Le résultat est ici
http://www.laryngo.com/video.php

pour pouvoir inclure ces vidéos dans mon portail phpBB, je dois installer ce fichier dans cette arborescence
http://www.laryngo.com/forum/styles/provereor/template/portal/block/

en y copiant ce fichier, lorsque je veux voir le résultat, j'ai un message d'erreur :

Warning: include(./forum/common.php) [function.include]: failed to open stream: No such file or directory in /home/laryngo/public_html/forum/styles/provereor/template/portal/block/video.php on line 5

Warning: include(./forum/common.php) [function.include]: failed to open stream: No such file or directory in /home/laryngo/public_html/forum/styles/provereor/template/portal/block/video.php on line 5

Warning: include() [function.include]: Failed opening './forum/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/laryngo/public_html/forum/styles/provereor/template/portal/block/video.php on line 5

Fatal error: Call to a member function session_begin() on a non-object in /home/laryngo/public_html/forum/styles/provereor/template/portal/block/video.php on line 6

Voici les premières lignes du fichier
<?php 
define('IN_PHPBB', true); 
$phpbb_root_path =  './forum/'; 
$phpEx = substr(strrchr(__FILE__, '.'), 1); 
include($phpbb_root_path . 'common.' . $phpEx);


comment dois je le modifier pour qu'il s'affiche correctement ?

Merci d'avance pour votre aide

11 réponses

  1. Je ne suis pas hyper calé en php mais je peux dors et déjà te dire que les emplacement des fichiers que inclus sont faux... Maintenant je pense que le bout code que tu donne n'est pas assez long pour qu'on puisse t'en dire plus, surtout pour l'erreur fatale ^^
    1. <?php 
      define('IN_PHPBB', true); 
      $phpbb_root_path =  './forum/'; 
      $phpEx = substr(strrchr(__FILE__, '.'), 1); 
      include($phpbb_root_path . 'common.' . $phpEx); 
      $user->session_begin(); 
      $auth->acl($user->data); 
      $user->setup(); 
      $forum_id = request_var('forum_id', 0); 
      $dontshow = 20; 
      $where = ($dontshow) ? " WHERE forum_id <> $dontshow" : ''; 
      $sql = 'SELECT forum_id,topic_id, topic_time, topic_title, topic_views, topic_replies, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time 
         FROM ' . TOPICS_TABLE . 
            $where . 
            ' ORDER BY topic_last_post_time DESC ' . 
            ' LIMIT 0 , 5 '; 
      $result = $db->sql_query($sql); 
      ?> 
      
      <?php 
      $videos = array( 
      //--> NOUS RESTONS VIGILANTS 
       array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.youtube.com/v/Gz-GQyPfg80&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00' 
       ) 
      //--> IADE UNITED 
       ,array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.youtube.com/v/HHQrGrmA4-I&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00' 
       ) 
       ,array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.dailymotion.com/swf/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B' 
       ) 
       ,array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.dailymotion.com/swf/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B' 
       ) 
       ,array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.dailymotion.com/swf/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B' 
       ) 
      //--> VIDEO BREST 18 juin 
       ,array( 
        'width' => '400' 
        ,'height' => '300' 
        ,'src' => 'http://www.youtube.com/v/mlUhM-qp0SU&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00' 
       ) 
      
      ); 
      $video_a_afficher = $videos[rand(0,sizeof($videos) - 1)]; 
      ?> 
      <script language="JavaScript" type="text/JavaScript"> 
      <!-- 
      function MM_reloadPage(init) {  //reloads the window if Nav4 resized 
        if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { 
          document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} 
        else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); 
      } 
      MM_reloadPage(true); 
      //--> 
      </script> 
      <body text="#000000" link="#990000"> 
      <div align="center"> </div> 
      <p>  
        <object width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>"> 
          <param name="movie" value="<?php echo $video_a_afficher['src'];?>"> 
          <param name="allowFullScreen" value="true"> 
          <param name="allowScriptAccess" value="always"> 
          <embed type="application/x-shockwave-flash" src="<?php echo $video_a_afficher['src'];?>" width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>" allowfullscreen="true" allowscriptaccess="always"></embed></object> 
      </p> 
      
      1. Déjà, il me semble que tu programmes en POO (programmation orientée objet), et que donc, l'erreur fatale (celle qu'il faut résoudre en premier, je présume...) serait due a un objet non défini : en l'occurrence, c'est session_begin() . J'en déduis donc que ta classe n'est pas appelée. J'en déduis encore que tout tes problèmes sont dus à tes includes comportant un mauvais emplacement.
        Et j'espère pour toi que quelqu'un de meilleur que moi en php pourras te conseiller.
        1. Ton explication me dépasse un peu techniquement, mais un truc m'intrique.

          Je ne vois pas pourquoi mon fichier traite de sessions et de forums alors qu'il s'agit juste d'afficher aléatoirement des vidéos youtube, daylimotion, etc etc...

          je pense que j'ai fait un mauvais mix avec le reste de ma page d'accueil d'origine (www.laryngo.com), où effectivement j'affiche les derniers sujets du forum.

          Merci de ton aide enj tout cas...
          1. Ce code ne sert a rien pour ce que je veux faire avec les vidéos, c'est une partie qui sert pour récuperer les derniers sujets du forum...

            <?php 
            define('IN_PHPBB', true); 
            $phpbb_root_path =  './forum/'; 
            $phpEx = substr(strrchr(__FILE__, '.'), 1); 
            include($phpbb_root_path . 'common.' . $phpEx); 
            $user->session_begin(); 
            $auth->acl($user->data); 
            $user->setup(); 
            $forum_id = request_var('forum_id', 0); 
            $dontshow = 20; 
            $where = ($dontshow) ? " WHERE forum_id <> $dontshow" : ''; 
            $sql = 'SELECT forum_id,topic_id, topic_time, topic_title, topic_views, topic_replies, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time 
               FROM ' . TOPICS_TABLE . 
                  $where . 
                  ' ORDER BY topic_last_post_time DESC ' . 
                  ' LIMIT 0 , 5 '; 
            $result = $db->sql_query($sql); 
            ?> 
            1. Ca donne ca en virant la recherche des sessions

              http://www.laryngo.com/forum/styles/provereor/template/portal/block/testeur.html

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <html>
              <head>
              <title>fichier testeur</title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
              
              </head>
              
              {$C_BLOCK_H_L}testeur{$C_BLOCK_H_R}
              
              <body>
              
              <?php
              $videos = array(
              //--> NOUS RESTONS VIGILANTS
              	array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/Gz-GQyPfg80&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
              	)
              //--> IADE UNITED
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/HHQrGrmA4-I&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
              	)
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.dailymotion.com/swf/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
              	)
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.dailymotion.com/swf/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
              	)
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.dailymotion.com/swf/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
              	)
              //--> VIDEO BREST 18 juin
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/mlUhM-qp0SU&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
              	)
              	//--> VIDEO laryngo 18 juin
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.megavideo.com/v/BEJWNVOC3ca1142a4303d885a56d942778a56840'
              	)
              		//--> VIDEO 18 juin aristoIADE
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/kdKM5JDuTm0&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
              	)
              				//--> LARYNGO BANDE SON MINISTERE 25 JUIN
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.megavideo.com/v/IQ0I96RQ6b8c1f213e9ee107d1911bf3f8f3fd68'
              	)
              	//--> BACHELOT RMC
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/IYlVq1zD8RU&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
              	)
              			//--> 18 Juin BFC partie 1
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/OCFd1AHy8jM&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
              	)
              		//--> 18 Juin BFC partie 2
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/mjgXFj6PNTU&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
              	)
              			//--> Printemps IADE
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/DlFDhJEQ218&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
              	)
              				//--> Vague Bleue
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.megavideo.com/v/JP6XFJ7Rf09d064efaef13d39ec4b985c15817e5'
              	)
              //--> BFC 24h IADE Vs BACHELOT
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/0hSNJIXhpb8?fs=1&amp;hl=fr_FR'
              	)
              	//--> laryngo DDAY IADE
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/Dms8h8p3OF0?fs=1&amp;hl=fr_FR'
              	)
              		//--> Vendredi Noir IADE
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.dailymotion.com/swf/video/xf35ut?additionalInfos=0'
              	)
              		//--> 1 octobre Vendredi Noir IADE
              	,array(
              		'width' => '400'
              		,'height' => '300'
              		,'src' => 'http://www.youtube.com/v/RvuoWaSkzVA?fs=1&amp;hl=fr_FR'
              	)
              );
              $video_a_afficher = $videos[rand(0,sizeof($videos) - 1)];
              ?>
              
              <body text="#000000" link="#990000">
              <p> 
                <object width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>">
                  <param name="movie" value="<?php echo $video_a_afficher['src'];?>">
                  <param name="allowFullScreen" value="true">
                  <param name="allowScriptAccess" value="always">
                  <embed type="application/x-shockwave-flash" src="<?php echo $video_a_afficher['src'];?>" width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>" allowfullscreen="true" allowscriptaccess="always"></embed></object>
              </p>
              
              </body>
              {$C_BLOCK_F_L}{$C_BLOCK_F_R}
              </html>
              


              Sur le portail par contre, ca reste un carré blanc...
              1. J'ignore si je suis hors-sujet mais quand je vais sur ta page d'accueil, la vidéo chargée se change bien aléatoirement...
                1. Sur la page actuelle oui, ça marche bien
                  http://www.laryngo.com/forum/portal.php

                  mais sur mon portail (future page d'accueil de mon forum), ça ne fonctionne pas. C'est là que j'ai mon problème
                  http://www.laryngo.com/forum/portal.php
                  1. Et petite question : rassures moi, tu n'as qu'un seul fichier qui récupère la vidéos, et tu l'affiche dans chaque page où c'est nécessaire grâce à une include ?
                2. Tout se passe dans un seul fichier, qui contient toutes les adresses youtube, DM... des vidéos, et un petit script (pour lequel on m'a aidé) pour les sortir aléatoirement

                  son contenu est quelques messages plus haut
                  https://forums.commentcamarche.net/forum/affich-22395096-probleme-parametrage-phpbb-root-path#6

                  il est visualisable ici
                  http://www.laryngo.com/forum/styles/provereor/template/portal/block/testeur.html

                  les lignes au dessus et en dessous de la vidéo sont les 'repères' nécessaires pour que le portail prenne en compte le fichier
                  ( http://www.board3.de/knowledge/kb_show.php?id=51 )

                  c'est ce fichier que j'appelle dans mon portail, mais qui ne s'y affiche pas correctement.
                  1. Déjà, j'ai remarqué que tu avais remis la partie head, avec les meta, ainsi que les balise body et html dans ton include, or les includes ne sont que des bout de pages inclues dans d'autres, ce qui veux dire que tu as déjà l'entete et le corps de la page dans la page incluante. En gros, je te conseil déjà de virer de ton script les balises head et leur contenu et les balise body et html. Ca sera déjà plus clair quand on regardera le code source de ta page. ;)
                    1. Avec quelques jour de délai, j'ai fais les modifs

                      http://www.laryngo.com/forum/styles/provereor/template/portal/block/testeur.html

                      {$C_BLOCK_H_L}testeur{$C_BLOCK_H_R}
                      
                      <?php
                      $videos = array(
                      //--> NOUS RESTONS VIGILANTS
                      	array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/Gz-GQyPfg80&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
                      	)
                      //--> IADE UNITED
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/HHQrGrmA4-I&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
                      	)
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.dailymotion.com/swf/video/xd4wiy?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
                      	)
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.dailymotion.com/swf/video/xd76r0?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
                      	)
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.dailymotion.com/swf/video/xddw53?background=%23171D1B&foreground=%23F7FFFD&highlight=%230EFF00&autoPlay=0&hideInfos=0&width=320&additionalInfos=1&colors=background%3A171D1B%3Bforeground%3AF7FFFD%3Bspecial%3A0EFF00%3B'
                      	)
                      //--> VIDEO BREST 18 juin
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/mlUhM-qp0SU&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
                      	)
                      	//--> VIDEO laryngo 18 juin
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.megavideo.com/v/BEJWNVOC3ca1142a4303d885a56d942778a56840'
                      	)
                      		//--> VIDEO 18 juin aristoIADE
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/kdKM5JDuTm0&hl=fr_FR&fs=1&color1=0x234900&color2=0x4e9e00'
                      	)
                      				//--> LARYNGO BANDE SON MINISTERE 25 JUIN
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.megavideo.com/v/IQ0I96RQ6b8c1f213e9ee107d1911bf3f8f3fd68'
                      	)
                      	//--> BACHELOT RMC
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/IYlVq1zD8RU&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
                      	)
                      			//--> 18 Juin BFC partie 1
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/OCFd1AHy8jM&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
                      	)
                      		//--> 18 Juin BFC partie 2
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/mjgXFj6PNTU&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
                      	)
                      			//--> Printemps IADE
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/DlFDhJEQ218&amp;hl=fr_FR&amp;fs=1?color1=0x234900&amp;color2=0x4e9e00'
                      	)
                      				//--> Vague Bleue
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.megavideo.com/v/JP6XFJ7Rf09d064efaef13d39ec4b985c15817e5'
                      	)
                      //--> BFC 24h IADE Vs BACHELOT
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/0hSNJIXhpb8?fs=1&amp;hl=fr_FR'
                      	)
                      	//--> laryngo DDAY IADE
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/Dms8h8p3OF0?fs=1&amp;hl=fr_FR'
                      	)
                      		//--> Vendredi Noir IADE
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.dailymotion.com/swf/video/xf35ut?additionalInfos=0'
                      	)
                      		//--> 1 octobre Vendredi Noir IADE
                      	,array(
                      		'width' => '400'
                      		,'height' => '300'
                      		,'src' => 'http://www.youtube.com/v/RvuoWaSkzVA?fs=1&amp;hl=fr_FR'
                      	)
                      );
                      $video_a_afficher = $videos[rand(0,sizeof($videos) - 1)];
                      ?>
                      
                      <body text="#000000" link="#990000">
                      <p> 
                        <object width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>">
                          <param name="movie" value="<?php echo $video_a_afficher['src'];?>">
                          <param name="allowFullScreen" value="true">
                          <param name="allowScriptAccess" value="always">
                          <embed type="application/x-shockwave-flash" src="<?php echo $video_a_afficher['src'];?>" width="<?php echo $video_a_afficher['width'];?>" height="<?php echo $video_a_afficher['height'];?>" allowfullscreen="true" allowscriptaccess="always"></embed></object>
                      </p>
                      
                      {$C_BLOCK_F_L}{$C_BLOCK_F_R}