Página 1 de 1

intento integrar fotos de la fan page a pagina personalizada

Publicado: 28 Dic 2011, 01:28
por Megabyte
Bueno, les dejo lo que encontré navegando y quisiera realizar, pero me sale un erroron..
y es que las muestra, pero sobre el header y no enmedio....

tengo ésto en el archivo raiz:
SPOILER_SHOW

Código: Seleccionar todo

<?php
    /**
    *
    * @package {PACKAGENAME}
    * @version $Id$
    * @copyright (c) 2007 Your Group Name
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License
    *
    */

    /**
    * @ignore
    */
    define('IN_PHPBB', true);
    // Specify the path to you phpBB3 installation directory.
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    // The common.php file is required.
    include($phpbb_root_path . 'common.' . $phpEx);

    // since we are grabbing the user avatar, the function is inside the functions_display.php file since RC7
    include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);

    $user->setup('mods/fotosface');

    define('PAGE_ID', '112460488815413');
    define('APP_ID','');
    define('APP_SECRET','');

class FacePageAlbum
{
        private $URL;
        private $TOKEN;
        private $PAGE;
        private $PHOTOS;
        private function setPage()
        {
                $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
                $this->PAGE = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
        }

        private function setAlbumUrl($id)
        {
            if(is_numeric($id))
            {
                if($this->TOKEN)
                {
                    $this->URL = "http://graph.facebook.com/".$id."/albums?".$this->TOKEN;
                    return true;
                }
                else
                {
                    $this->URL = "http://graph.facebook.com/".$id."/albums";
                    return true;                
                }
            }
            else
            {
                return false;
            }
        }
        private function setToken($appId, $appSecret)
        {
            $this->TOKEN = $this->curlGetFile('https://graph.facebook.com/oauth/access_token?type=client_cred&client_id='.$appId.'&client_secret='.$appSecret);
        }
        
        public function FacePageAlbum($id, $albumId, $aurl, $appId, $appSecret)
        {
            $this->setPage();
            if($id)
            {
                if($appId && $appSecret)
                    $this->setToken($appId, $appSecret);
                $this->setAlbumUrl($id);
                if($albumId && $this->albumChk($albumId))
                {
                    $this->PHOTOS = 'http://graph.facebook.com/'.$albumId.'/photos';
                    $json  = json_decode($this->curlGetFile($this->PHOTOS));
                    if($json -> error) die("THERE HAS BEEN AN ERROR:album id invalid");
                    echo '<a id="back" href="javascript:history.go(-1)">Regresar</a>';
                    echo '<a id="backAlbums" href="'.$this->PAGE.'">Volver a los albums</a>';
                    echo '<br clear="all" />';
                    
                    if($json->paging->previous)
                        echo '<a id="prev" href="'.$PAGE.'?aurl='.urlencode($json->paging->previous).'">Anterior</a>';
                    if($json->paging->next)
                        echo '<a id="next" href="'.$PAGE.'?aurl='.urlencode($json->paging->next).'">Siguiente</a>';
                    echo '<br clear="all" />';
                    foreach($json->data as $v)
                    {
                        echo "<a class='ImageLink' href = '".$v->source."'><img width='110px' src='".$v->picture."' /></a>";
                    }
                    return true;
                }
                else if ($aurl)
                {
                    $this->PHOTOS = urldecode($aurl);
                    $json  = json_decode($this->curlGetFile($this->PHOTOS));
                    if($json -> error) die("THERE HAS BEEN AN ERROR: album url invalid");
                    echo '<a id="back" href="javascript:history.go(-1)">Regresar</a>';
                    echo '<a id="backAlbums" href="'.$this->PAGE.'">Volver a los albums</a>';
                    echo '<br clear="all" />';
                    if($json->paging->previous)
                        echo '<a id="prev" href="'.$PAGE.'?aurl='.urlencode($json->paging->previous).'">Anterior</a>';
                    if($json->paging->next)
                        echo '<a id="next" href="'.$PAGE.'?aurl='.urlencode($json->paging->next).'">Siguiente</a>';
                    echo '<br clear="all" />';
                    foreach($json->data as $v)
                    {
                        echo "<a class='ImageLink' href = '".$v->source."'><img width='110px' src='".$v->picture."' /></a>";
                    }
                    return true;
                }
                else
                {
                    $json = json_decode($this->curlGetFile($this->URL));
                    if($json -> error) die("THERE HAS BEEN AN ERROR: pageId invalid");
                    foreach($json->data as $v)
                    {
                    echo "<div class ='ImgWrapper'>";
                    echo "<div style = 'width:125px; height:120px;overflow:hidden'>
                            <img width='125px' src='https://graph.facebook.com/".$v->id."/picture' />
                          </div>";
                        echo  $v->from->name."<br>";
                        echo  "<a href = '".$this->PAGE;
                        echo  "?";
                        echo  "aid=".$v->id."'>".$v->name."</a>";
                        echo  "<br>Num de imagenes:".$v->count."<br>";
                        echo "<br clear='all'></div>";
                    }
                    return true;
                }
            }
            return false;
        }
        public function curlGetFile($curlUrl)
        {
            $ch = curl_init(); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, $curlUrl); 
            $data = curl_exec($ch); 
            curl_close($ch);
            return $data;
        }
        
        public function albumChk($albumId)
        {
            $json = json_decode($this->curlGetFile($this->URL));
            $arrayId = array();
            foreach($json->data as $v)
                        array_push($arrayId, $v->id);
            if(!in_array($albumId,$arrayId)) return false;
            return true;
        }
};

   $face = new FacePageAlbum(PAGE_ID, $_GET['aid'], $_GET['aurl'], APP_ID, APP_SECRET);

        $template->assign_block_vars('fotosfacebook', array(
        'FOTO_FACEBOOK' => $face,
        ));
	
    // Page title, this language variable should be defined in the language file you setup at the top of this page.
    page_header($user->lang['MY_TITLE']);

    // Set the filename of the template you want to use for this file.
    // This is the name of our template file located in /styles/<style>/templates/.
    $template->set_filenames(array(
        'body' => 'fotosface.html',
    ));

    // Completing the script and displaying the page.
    page_footer();

    ?>
y pues puse solo ésto en el html respectivo (tambien tengo el php en language/es/mods)

Código: Seleccionar todo

<!-- INCLUDE overall_header.html -->

 	<!-- BEGIN fotosfacebook -->
			
{fotosfacebook.FOTO_FACEBOOK}
			
	<!-- END fotosfacebook -->
<!-- INCLUDE overall_footer.html -->
OBSERVACION:
Primero lo probe con dos archivos php y utilizando permitiendo php en el template, pero el estilo que utilizo se me "descoloreo"... :D :D :D
Por lo tanto opté a ésta opcion, aparte q no me gusta darle PERMITIR php dentro de las plantillas....

Veremos si me podeis hechar un cable... :)
link para ver el errorron:
SPOILER_SHOW
Contenido Oculto
Este foro requiere que este registrado e identificado para ver el contenido oculto.
Gracias...

Re: intento integrar fotos de la fan page a pagina personali

Publicado: 28 Dic 2011, 01:41
por Makoto
alguna imagen? del error :shock:

Re: intento integrar fotos de la fan page a pagina personali

Publicado: 28 Dic 2011, 01:46
por Megabyte
El enlace lo deje ahi, y pues aca la imagen:

Imagen

Re: intento integrar fotos de la fan page a pagina personali

Publicado: 28 Dic 2011, 02:08
por Makoto
probaste quitando esta linea?

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

Re: intento integrar fotos de la fan page a pagina personali

Publicado: 28 Dic 2011, 02:14
por Megabyte
si probé... pero tira lo mismo... :D

entonces la volví a colocar... :D

Re: intento integrar fotos de la fan page a pagina personali

Publicado: 28 Dic 2011, 03:38
por leviatan21
el problema es que tu archivo utiliza el comando "echo" para mostrar textos y eso en phpbb no funciona de la misma manera, debes transformar todos esos echo en una variable para que sea devuelta a phpbb y éste se encargue de mostrar los textos