Style for Mobile!!!!

If you have any questions or suggestions for this website (including the main site, forums, wiki, and anything else), post here.
Post Reply
Message
Author
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Style for Mobile!!!!

#1 Post by Lamkefyned »

If you think something is right just because everyone else believes,you're not thinking.
User avatar
Administrator
Site Admin
Posts: 5342
Joined: Sat Jan 05, 2008 4:21 pm

Re: Style for Mobile!!!!

#2 Post by Administrator »

Sure. No problem. It is installed and should be working.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#3 Post by Lamkefyned »

It does not work. This incorrectly installed.

Here I teach you to use this mod
---------------------------------------------------------------------------
In this tutorial I will explain how to support our forum with mobile

First it is important to unburden style mobile:

Downloads:
art_mobile_blue.zip
(133.09 KiB) Downloaded 770 times
(Download this is the other rare)

It rises in the styles folder like a common style. installed it in the ACP, and going out the options and going to get this:

Active Style: Yes
Default Style: No

Well now what we do is that when we go with our mobile forum style mobile automatically (Mobile Detection) turns

After installation style is necessary to know the ID style for mobile, what we know thus

go to ACP -> Styles -> and click Preview
mobile01b.png
Now let's edit the files

Open: includes/session.php and search:

Code: Select all

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

	   // User has wrong style  
Add this BEFORE:

Code: Select all

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

Code: Select all

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

Code: Select all

 // 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  
Now Search:

Code: Select all

 /**
   * More advanced language substitution
Make this BEFORE:

Code: Select all

// 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  
In the above line Search:

Code: Select all

	   $mobile_style_id = 0; 
Replace the ID

Code: Select all

0
style we got above.

Now Open: includes/functions.php and Search:

Code: Select all

// The following assigns all _common_ variables that may be used at any point in a template.  
Now add this BEFORE:

Code: Select all

 // 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  
As you Here is mobile forum but small:

Code: Select all

http://www.artodia.com/demo/phpbb30/index.php?style=31
Tutorial: http://www.phpbb-es.com/biblioteca/kb_show.php?id=37
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Administrator
Site Admin
Posts: 5342
Joined: Sat Jan 05, 2008 4:21 pm

Re: Style for Mobile!!!!

#4 Post by Administrator »

I made the necessary changes and validated that it is working this time. Yesterday was just a busy day.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#5 Post by Lamkefyned »

Fun Fact homepage but it is not running
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#6 Post by Lamkefyned »

Now if you are running
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Administrator
Site Admin
Posts: 5342
Joined: Sat Jan 05, 2008 4:21 pm

Re: Style for Mobile!!!!

#7 Post by Administrator »

I'm not sure what you're trying to say.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#8 Post by Lamkefyned »

That in my Android function to perfection
If you think something is right just because everyone else believes,you're not thinking.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Style for Mobile!!!!

#9 Post by rock5 »

I rarely use the internet on my android, let alone check my solarstrike posts, but I have done so on a few occasions. There was a lot of zooming and scrolling to read posts. This definitely makes it a lot easier. Good idea. :)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#10 Post by Lamkefyned »

It is easy to use, Internet use little, and zoom this normal
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#11 Post by Lamkefyned »

I am small but ready xD
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: Style for Mobile!!!!

#12 Post by Ego95 »

I was really shocked when I saw this skin. Thankfully, I can turn it off :D
User avatar
Administrator
Site Admin
Posts: 5342
Joined: Sat Jan 05, 2008 4:21 pm

Re: Style for Mobile!!!!

#13 Post by Administrator »

You should be able to use the "Full Version" link at the bottom of the page. I figured that as a logged-in user it would use your selected theme that you can set in your user control panel.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#14 Post by Lamkefyned »

I have the default Ubuntu on my profile and I can see the full version of ubuntu
If you think something is right just because everyone else believes,you're not thinking.
User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: Style for Mobile!!!!

#15 Post by Lamkefyned »

I have some more changes to the web but tomorrow it's three in the morning and I have school tomorrow and examination
If you think something is right just because everyone else believes,you're not thinking.
Post Reply