Recordad que para pedir soporte alguno, debéis facilitar los datos de soporte oportunos por favor, mirad aquí y leer las Normas generales del foro, esto nos servirá de ayuda para dar el mejor soporte..

Gracias.

La Administración de phpBB España.

intento integrar fotos de la fan page a pagina personalizada

Foros donde podréis dejar vuestras dudas sobre phpBB 3.0.x
Cerrado

0
No hay votos
 
Votos totales: 0

Avatar de Usuario
Megabyte
Elite
Mensajes: 1037
Registrado: 25 Dic 2010, 02:39
Edad: 45

intento integrar fotos de la fan page a pagina personalizada

#1

Mensaje 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...
Contenido Oculto
Este foro requiere que este registrado e identificado para ver el contenido oculto.

Avatar de Usuario
Makoto
Elite
Mensajes: 2929
Registrado: 10 Sep 2009, 23:44
Género:
Edad: 37

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

#2

Mensaje por Makoto »

alguna imagen? del error :shock:
URL del foro: FIIS-UNAC
Versión phpBB: phpBB3 ( 3.1.5)
Extensiones Instaladas
SPOILER_SHOW
  • Add User 1.0.2
  • Auto Database Backup 1.1.0
  • Auto Groups 1.0.0
  • Avatars on Memberlist 1.0.3
  • Board Announcements 1.0.2
  • Board Rules 1.0.1
  • cBB Chat 1.1.1
  • Fancy Lazy Topics loader 2.1.5
  • Genders 1.0.0
  • Last Post Avatar
  • Log failed logins
  • Rank Post Styling
  • Share On 1.0.0
  • SiteSplat BBCore 2.1.1
  • Sortables Captcha 2.0.0
  • Topic Author 1.0.1
  • Upload Extensions 3.1.2-beta2
Plantilla(s) usada(s):
  • FLATBOOTS 2.0.1
Servidor: Dattatec[/size]

Avatar de Usuario
Megabyte
Elite
Mensajes: 1037
Registrado: 25 Dic 2010, 02:39
Edad: 45

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

#3

Mensaje por Megabyte »

El enlace lo deje ahi, y pues aca la imagen:

Imagen
Contenido Oculto
Este foro requiere que este registrado e identificado para ver el contenido oculto.

Avatar de Usuario
Makoto
Elite
Mensajes: 2929
Registrado: 10 Sep 2009, 23:44
Género:
Edad: 37

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

#4

Mensaje por Makoto »

probaste quitando esta linea?

include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
URL del foro: FIIS-UNAC
Versión phpBB: phpBB3 ( 3.1.5)
Extensiones Instaladas
SPOILER_SHOW
  • Add User 1.0.2
  • Auto Database Backup 1.1.0
  • Auto Groups 1.0.0
  • Avatars on Memberlist 1.0.3
  • Board Announcements 1.0.2
  • Board Rules 1.0.1
  • cBB Chat 1.1.1
  • Fancy Lazy Topics loader 2.1.5
  • Genders 1.0.0
  • Last Post Avatar
  • Log failed logins
  • Rank Post Styling
  • Share On 1.0.0
  • SiteSplat BBCore 2.1.1
  • Sortables Captcha 2.0.0
  • Topic Author 1.0.1
  • Upload Extensions 3.1.2-beta2
Plantilla(s) usada(s):
  • FLATBOOTS 2.0.1
Servidor: Dattatec[/size]

Avatar de Usuario
Megabyte
Elite
Mensajes: 1037
Registrado: 25 Dic 2010, 02:39
Edad: 45

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

#5

Mensaje por Megabyte »

si probé... pero tira lo mismo... :D

entonces la volví a colocar... :D
Contenido Oculto
Este foro requiere que este registrado e identificado para ver el contenido oculto.

Avatar de Usuario
leviatan21
Ex Staff
Mensajes: 8279
Registrado: 26 Mar 2008, 20:06
Género:
Edad: 55

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

#6

Mensaje 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
Normas de phpBB España | Normas de Soporte
No doy soporte por privado : tenga en cuenta que su problema, también puede ser el problema de otro usuario.
Cualquier mensaje privado no solicitado será ignorado :twisted:

"Education is what remains after one has forgotten everything he learned in school" - Albert Einstein

Cerrado

Volver a “Foros de Soporte 3.0.x”