Author Topic: How Can i make phone browser switch  (Read 13763 times)

0 Members and 1 Guest are viewing this topic.

Offline nameless

  • Full Member
  • ***
  • Posts: 147
    • View Profile
How Can i make phone browser switch
« on: May 11, 2015, 05:24:36 AM »
Hello

How Can i make phone browser switch

I have my site
www.mysite.com

and i made a mobile ver
www.mysite.com/mobile

how can i make phone browser switch
when u enter the site from a phone this www.mysite.com/mobile work
when u enter the site from a computer this www.mysite.com work

i found this but i do 't understant any thing from it

http://www.4homepages.de/forum/index.php?topic=30818.0

thanks for all ur help

« Last Edit: May 11, 2015, 06:00:47 AM by nameless »

Rembrandt

  • Guest
Re: How Can i make phone browser switch
« Reply #1 on: May 11, 2015, 09:48:12 PM »
Hi!

1.) Create a new Folder  ../templates/mobile
2.) search in global.php:

define
('TEMPLATE_PATH'ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);

insert above:

$agent 
= array(
  
"Android",
  
"webOS",
  
"iPhone",
  
"iPod",
  
"Android",
  
"Blackberry",
  
"OperaMobi",
  
"Opera Mini",
  
"IEMobile",
  
"Jasmine",
  
"Fennec",
  
"Blazer",
  
"Minimo",
  
"MOT-",
  
"Nokia",
  
"SAMSUNG",
  
"Polaris",
  
"LG-",
  
"SonyEricsson",
  
"SIE-",
  
"AUDIOVOX",
  
"mobile",
);

foreach(
$agent AS $name){
  if( 
strstr($_SERVER['HTTP_USER_AGENT'],$name)){
    
$config['template_dir'] = "mobile";
  }else{
    
$config['template_dir'] = $config['template_dir'];
  }
}


Now create a new template only for mobile Devices in the new Folder "mobile".

mfg Andi

Offline nameless

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How Can i make phone browser switch
« Reply #2 on: May 12, 2015, 01:20:54 AM »
thanks Rembrandt for ur replay

It work but we have some problem when i make the mobile ver. just a template in the original site

so we have to make the mobile ver. a new copy with the same database but defrant in the setting table

and i make all this

My original site is www.domain.com
the mobile ver. is www.domain.com/mobile

so how can i switch between the too sites


look at this site he make it but i do't know how
http://www.mps-fotos.de/4images/
http://www.mps-fotos.de/mobile/



thanks

Rembrandt

  • Guest
Re: How Can i make phone browser switch
« Reply #3 on: May 12, 2015, 04:57:05 AM »
search in the code:


foreach($agent AS $name){
  if( 
strstr($_SERVER['HTTP_USER_AGENT'],$name)){
    
$config['template_dir'] = "mobile";
  }else{
    
$config['template_dir'] = $config['template_dir'];
  }
}

and replace:

foreach($agent AS $name){
  if( 
strstr($_SERVER['HTTP_USER_AGENT'],$name)){
    
header('Location: http://www.domain.com/mobile');
  }
}

Offline nameless

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How Can i make phone browser switch
« Reply #4 on: May 12, 2015, 05:29:27 AM »
thanks thanks thanks Rembrandt

i make it and work great

But still one problem
----------------------------

in the mobile ver. i need to make a link (View this site in Normal view)

like this site
http://www.mps-fotos.de/mobile/
the link in the end of the page
Diese Seite in der Normalansicht ansehen.


thanks againe

Offline nameless

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How Can i make phone browser switch
« Reply #5 on: May 17, 2015, 12:31:46 PM »
Will some one help me

in the mobile ver. i need to make a link (View this site in Normal view) to play the normal site on the mobile

like this site
http://www.mps-fotos.de/mobile/
the link in the end of the page
Diese Seite in der Normalansicht ansehen.

i found this but i do 't understant any thing from it

http://www.4homepages.de/forum/index.php?topic=30818.0

Offline Scarala

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • www.MPS-Fotos.de - Die MPS-Fotocommunity
Re: How Can i make phone browser switch
« Reply #6 on: June 16, 2015, 06:57:08 AM »
On the mobile site you need to insert:
<a href="../4images/<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>
where the Links should be shown.

On desktop-page you need to insert:
<a href="../mobile/<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>
where the Links should be shown.

You need to change /4images/ and /mobile/ with your subfolder-names.

Offline nameless

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How Can i make phone browser switch
« Reply #7 on: June 23, 2015, 05:52:32 AM »
Thanks Scarala for ur help

<a href="../<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>

i try it but it did not work at the mobile but it work at my computer

i mean when i run the mobile site from my computer and i use to see the desktop pape it work

but when i run the mobile site from my mobile and i use to see the desktop pape it did't work

I hope u can find why it did not work

thanks agane
« Last Edit: June 23, 2015, 10:06:12 PM by nameless »

Offline Scarala

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • www.MPS-Fotos.de - Die MPS-Fotocommunity
Re: How Can i make phone browser switch
« Reply #8 on: July 16, 2015, 08:22:25 AM »
This is really difficult for me to explain...
Quote
<a href="../<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>
Your Desktop-Page has to be in an Subfolder too.
Otherwise the Script from Rembrandt will redirect you automaticaly to mobile page.

In Root folder i have following index.php-File:
<head>
<
title>You Sitename</title>
<?
php
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Android') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'OperaMobi') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'IEMobile') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Jasmine') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Fennec') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Blazer') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Minimo') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'MOT-') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Nokia') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'SAMSUNG') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'Polaris') ||
    
strstr($_SERVER['HTTP_USER_AGENT'], 'LG-'))
    {
    echo 
'<script type="text/javascript">';
    echo 
'window.location.href = "mobile";';
    echo 
'</script>';
    }
?>
<meta http-equiv="refresh" content="0; URL=4images">
</head>


So if itīs a Mobile Client the User is redirected to subfolder /mobile
If itīs a Desktop Client the User is redirected to subfolder /4images

And then you neet to change
<a href="../<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>
to
<a href="../4images/<?php echo basename($_SERVER[SCRIPT_NAME]) . '?' . $_SERVER['QUERY_STRING'];  ?>" target="_self">Open desktop page.</a>

Voila, everything will work fine ;-)