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.

Formato Móvil para phpBB 3.0Tema Solucionado

Soporte de MODs para phpBB 3.0.x
Dudas sobre AutoMOD aquí por favor.
Cerrado
Avatar de Usuario
Carlos Murillo
Ex Staff
Mensajes: 701
Registrado: 28 Nov 2011, 04:21
Género:
Edad: 33

Formato Móvil para phpBB 3.0  Tema Solucionado

#1

Mensaje por Carlos Murillo »

En este tutorial les explicare como hacer nuestro foro compatible con los móviles :bravo:

Primero es importante descargarnos el estilo para los móviles:
http://www.artodia.com/phpbb-mobile/prosilver.html
Se sube en la carpeta styles como si fuera un estilo común. lo instalamos en el ACP,y van a salir las opciones y las van a poner así:
Estilo Activo: si
Estilo por Defecto: No

Bueno ahora lo que vamos hacer es que al momento de que entremos con un móvil a nuestro foro se ponga el estilo para móviles automáticamente (Mobile Detection)

Luego de la instalación del estilo es necesario saber el ID del estilo para móviles, lo podemos saber de esta forma:
ir a ACP -> Estilos -> y dar click en Vista Previa
Imagen

Luego, busquen en la URL en el navegador, se vería index.php? Style = 11 & sid =

Imagen
El valor que esta a un lado de "style" es el ID

Ahora vamos a editar los archivos
Abrir: includes/session.php y Busca:

Código: Seleccionar todo

   $result = $db->sql_query($sql, 3600);
       $this->theme = $db->sql_fetchrow($result);
       $db->sql_freeresult($result);

       // User has wrong style    
Agregar esto ANTES:

Código: Seleccionar todo

           // MOD start: Mobile/SEO style
           if($this->check_mobile($sql, $style))
           {
           // MOD end: Mobile/SEO style    
Ahora Busca:

Código: Seleccionar todo

 if (!$this->theme)
       {
           trigger_error('Could not get style data', E_USER_ERROR);
       }   
Agrega esto ANTES:

Código: Seleccionar todo

 // MOD start: Mobile/SEO style
       }
       if(defined('MOBILE_DEVICE_OFF'))
       {
           global $SID, $_EXTRA_URL;
           $SID .= '&nomobile=1';
           $_EXTRA_URL[] = 'nomobile=1';
       }
       // MOD end: Mobile/SEO style    
Ahora Busca:

Código: Seleccionar todo

 /**
   * More advanced language substitution
Agrega esto ANTES:

Código: Seleccionar todo

// MOD start: Mobile/SEO style
   /**
   * Check for mobile/seo, get style
   */
   function check_mobile($sql, $style)
   {
       $browser = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
       if (empty($this->data['is_bot']) && strpos($browser, 'Mobile') === false && strpos($browser, 'Symbian') === false && strpos($browser, 'Opera M') === false && strpos($browser, 'Android') === false && stripos($browser, 'HTC_') === false && strpos($browser, 'Fennec/') === false && stripos($browser, 'Blackberry') === false && strpos($browser, 'Windows Phone') === false && strpos($browser, 'WP7') === false && strpos($browser, 'WP8') === false)
       {
               return true;
       }
       define('MOBILE_DEVICE', true);
       if(!empty($_REQUEST['nomobile']))
       {
           define('MOBILE_DEVICE_OFF', true);
           return true;
       }
       global $db;
       // Important: change number 0 below to ID of Artodia:Mobile style.
       // If it is set to 0, script will automatically find style, but it will use extra time and resources.
       $mobile_style_id = 0;
       if($mobile_style_id)
       {
           $sql2 = str_replace('s.style_id = ' . $style, 's.style_id = ' . $mobile_style_id, $sql);
           $result = $db->sql_query($sql2, 3600);
           $this->theme = $db->sql_fetchrow($result);
           $db->sql_freeresult($result);
           if($this->theme !== false)
           {
               define('MOBILE_STYLE', true);
               return false;
           }
       }
       // try to find style
       global $phpbb_root_path;
       $files = scandir($phpbb_root_path . 'styles');
       $base = $phpbb_root_path . 'styles/';
       for($i=0; $i<count($files); $i++)
       {
           if($files[$i] != '.' && $files[$i] != '..' && is_dir($base . $files[$i]) && @file_exists($base . $files[$i] . '/style.cfg'))
           {
               // found directory with style
               $data = file_get_contents($base . $files[$i] . '/style.cfg');
               if(strpos($data, 'mobile = 1') !== false && ($pos = strpos($data, 'name = ')) !== false)
               {
                   $list = explode("\n", substr($data, $pos + 7), 2);
                   $name = trim($list[0]);
                   // found style
                   $sql2 = str_replace('s.style_id = ' . $style, 's.style_name = \'' . $db->sql_escape($name) . '\'', $sql);
                   $result = $db->sql_query($sql2, 3600);
                   $this->theme = $db->sql_fetchrow($result);
                   $db->sql_freeresult($result);
                   if($this->theme !== false)
                   {
                       define('MOBILE_STYLE', true);
                       return false;
                   }
               }
           }
       }
       return true;
   }
   // MOD end: Mobile/SEO style    
En la linea anterior Busca:

Código: Seleccionar todo

       $mobile_style_id = 0;   
Remplazar el 0 por el ID del estilo que conseguimos anteriormente.

Ahora Abre: includes/functions.php y Busca:

Código: Seleccionar todo

// The following assigns all _common_ variables that may be used at any point in a template.    
Y ahora agrega esto ANTES:

Código: Seleccionar todo

 // MOD start: Mobile/SEO style
   if(defined('MOBILE_DEVICE'))
   {
       $full_style = defined('MOBILE_DEVICE_OFF');
       if($full_style)
       {
           $s_search_hidden_fields['nomobile'] = 1;
           $mobile_text = isset($user->lang['MOBILE_ON']) ? $user->lang['MOBILE_ON'] : 'Mobile Version';
           $mobile_link = str_replace('nomobile=1&', '', append_sid("{$phpbb_root_path}index.$phpEx", 'nomobile=0'));
       }
       else
       {
           $mobile_text = isset($user->lang['MOBILE_OFF']) ? $user->lang['MOBILE_OFF'] : 'Full Version';
           $mobile_link = append_sid("{$phpbb_root_path}index.$phpEx", 'nomobile=1');
       }
       $mobile_html = '<a href="' . $mobile_link . '">' . $mobile_text . '</a>';
       $user->lang['TRANSLATION_INFO'] = (isset($user->lang['TRANSLATION_INFO']) ? $user->lang['TRANSLATION_INFO'] . ' ' : '') . $mobile_html;
       $template->assign_var('MOBILE_LINK', $mobile_html);
   }
   // MOD end: Mobile/SEO style    

Tutorial sacado de: http://www.artodia.com/mod-installation ... _prosilver
Traducido por Ruso :bravo:

Mis Proyectos Personales: | Mostrar
- Foro phpBB3: http://www.sinaloa-mp3.org
- Version de phpBB: 3.1.4
- Tema Instalado: Ariki (De Pago)
- Extenciones Instaladas:
Aun no
- Servidor: Linux, De Paga

- Foro phpBB3: http://www.epicenterxbass.com/foro
- Version de phpBB: 3.1.4
- Tema Instalado: IDLaunch ported 3.1.x by phpBB Spain
- Extenciones Instaladas:
Advanced BBCode Box
Announcements on index
Annual Stars
Board Announcements
Breadcrumb Menu
Browse Happy
External Links Open in New Window
Forum Disclaimer
Google AdSense
Last Post Avatar
Loading indicator
phpBB3 SEO Sitemap
Precise Similar Topics
Private Message Box Status Bars
Quickedit
Quick Login
Scroll To Top
Seo Meta Description
TinyPic Link
Top Five
Topic Author
Topic Preview
- Servidor: Linux, De Paga

- Foro phpBB3: http://www.phpbbmexico.com
- Version de phpBB: 3.1.4
- Tema Instalado: phpBBCis, Prosilver Especial Edition, Prosilver (Selector)
- Extenciones Instaladas:
Varios :D
- Servidor: Linux, De Paga
¿Buscas un buen hosting de Pago a muy bajo costo? Recomiendo a:
Imagen
SPOILER_SHOW
Carlos Murillo:
Conocimientos en: php, html, mysql, phpmyadmin, whm, whmcs, phpBB y un poco de photoshop xD.

Cerrado

Volver a “Soporte de MODs”