Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

If mobile

Asked Modified Viewed 6,210 times
H
Henrik Brobeck
H
  • Member, joined since
  • Contributed 158 posts on the community forums.
  • Started 28 threads in the forums
  • Started this discussions
asked
Member

Hey!
I wonder if its possible to add some code to make the users that visits with at mobile be transferred to a diffrent page.
Exampel:
User goes to my site and enters news.php, but if the users have a phone then the user will be transferred to mobile.php.
0 replies

10 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

http://www.php-fusion.co.uk/forum/viewthread.php?thread_id=23356&highlight=mobile&pid=133726#post_133726
0 replies
H
Henrik Brobeck
H
  • Member, joined since
  • Contributed 158 posts on the community forums.
  • Started 28 threads in the forums
  • Started this discussions
answered
Member

I have that wap2 thing. here www.skdyk.se/wap2
But i want it to be autodetecten and redirected to that site when u enter with a phone
0 replies
G
GMUDuckman
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums
answered
Senior Member

http://mobiforge.com/developing/story...ection-php

Googles is your friend. Simply make that a separate php file, then include it in your header. You may have to do further research to do other (newer) device detection such as iPhone. here is another newer one you can try too.

http://chrisschuld.com/projects/brows...-from-php/
0 replies
H
Henrik Brobeck
H
  • Member, joined since
  • Contributed 158 posts on the community forums.
  • Started 28 threads in the forums
  • Started this discussions
answered
Member

I dont really understand how to configure it.

I added browser.php that i downloaded in the link you gave me
http://chrisschuld.com/projects/brows...-from-php/

Then i put in the line on header_includes.php
add_to_head("<link rel='stylesheet' href='/browser.php' type='text/css' media='screen' />");


But where do i set where it should redirect to when ur on a phone?
0 replies
G
GMUDuckman
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums
answered
Senior Member

man o man i dont even know where to begin. First your include is not proper. you want to open themes/templates/header.php

add
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]require_once ('location/of/browser.php'wink;[/syntaxhighlighter]
after the other require onces. Then after that you want to write a php if statement calling the function in browser.php

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
$browser = new Browser();
if( $browser->getBrowser() == Browser::IE ) { //if browser is IE
header(‘Location: /ie’);
}
else if( $browser->getBrowser() == Browser::FIREFOX ) { //if browser if firefox
header(‘Location: /ff’);
}
else {//if browser is something else
header(‘Location: /other’);
}[/syntaxhighlighter]

in this case you probably want to is if browser is not equal to IE,firefox, chrome, or safari. His browser.php also includes a function to call the OS, which could also be helpful in detecting if it's mobile.

EDIT: ACTUALLY, its alot easier than that... it has a isMobile function. so you'd just want to do
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
$browser = new Browser();
if( $browser->isMobile()){//if is mobile
header(‘Location: /ie’);//redirect to WAP site.
}
[/syntaxhighlighter]
Edited by GMUDuckman on 28-03-2011 15:37,
0 replies
H
Henrik Brobeck
H
  • Member, joined since
  • Contributed 158 posts on the community forums.
  • Started 28 threads in the forums
  • Started this discussions
answered
Member

Better to try and fail then not try and just ask.

I get a error when adding

Error:

Quote


Warning: require_once(/Browser.php) [function.require-once]: failed to open stream: No such file or directory in /themes/templates/header.php on line 23

Fatal error: require_once() [function.require]: Failed opening required '/Browser.php' (include_path='.:/usr/local/lsws/lsphp5/lib/php'wink in /themes/templates/header.php on line 23
0 replies
G
GMUDuckman
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums
answered
Senior Member

that means you are not pointing to Browser.php 's proper location.
0 replies
Y
younis
Y
younis 10
Steve Younis
Superman Homepage - http://www.SupermanHomepage.com
Christopher Reeve Homepage - http://www.ChrisReeveHomepage.com/
Steve's Stuff - http://www.younis.com.au/
  • Member, joined since
  • Contributed 86 posts on the community forums.
  • Started 28 threads in the forums
answered
Member

Does your WAP2 work with Fusion 7.02?

Mine is showing a whole slew of errors. Examples below:

Quote

Notice: Undefined index: login_method in /.../htdocs/wap2/wap-maincore.php on line 248

Notice: Undefined variable: userdata in /.../htdocs/wap2/wap-maincore.php on line 836

Notice: Use of undefined constant THEME - assumed 'THEME' in /.../htdocs/includes/system_images.php on line 44
0 replies
— 9 months later —
J
jekov
J
jekov 10
  • Junior Member, joined since
  • Contributed 26 posts on the community forums.
  • Started 1 thread in the forums
answered
Junior Member

Hi,there
I use xhtml_mobile_mod_5.9v7.02
and my error log is:
wap2/wap-shouts.php
Undefined index: global_153 Line: 169
Undefined index: numofshouts Line: 178
Undefined index: global_156 Line: 201
wap2/wap-maincore.php
mysql_num_rows(): supplied argument is not a valid MySQL result resource Line: 233
On wap-shouts page with error mesage, but shuts are sending:
Notice: Use of undefined constant TRUE_PHP_SELF - assumed 'TRUE_PHP_SELF' in /home/a7176646/public_html/includes/error_handling_include.php on line 47
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
Can somebody help me ? Thank's!
Edited by jekov on 06-02-2012 08:28,
0 replies
L
lankantunes
L
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums
answered
Junior Member

Dear Friends
If you are having mobile site you can redirect the users who are coming to your domain name automatically to your mobile site.
Just put the below code to at the end of header.php
header.php file is in themes >>>>> templates >>>>>header.php

<?php
/*
=====================================================
Mobile version detection
-----------------------------------------------------
compliments of http://www.buchfelder.biz/
=====================================================
*/

$mobile = "mobile site url add here";
$text = $_SERVER['HTTP_USER_AGENT'];
$var[0] = 'Mozilla/4.';
$var[1] = 'Mozilla/3.0';
$var[2] = 'AvantGo';
$var[3] = 'ProxiNet';
$var[4] = 'Danger hiptop 1.0';
$var[5] = 'DoCoMo/';
$var[6] = 'Google CHTML Proxy/';
$var[7] = 'UP.Browser/';
$var[8] = 'SEMC-Browser/';
$var[9] = 'J-PHONE/';
$var[10] = 'PDXGW/';
$var[11] = 'ASTEL/';
$var[12] = 'Mozilla/1.22';
$var[13] = 'Handspring';
$var[14] = 'Windows CE';
$var[15] = 'PPC';
$var[16] = 'Mozilla/2.0';
$var[17] = 'Blazer/';
$var[18] = 'Palm';
$var[19] = 'WebPro/';
$var[20] = 'EPOC32-WTL/';
$var[21] = 'Tungsten';
$var[22] = 'Netfront/';
$var[23] = 'Mobile Content Viewer/';
$var[24] = 'PDA';
$var[25] = 'MMP/2.0';
$var[26] = 'Embedix/';
$var[27] = 'Qtopia/';
$var[28] = 'Xiino/';
$var[29] = 'BlackBerry';
$var[30] = 'Gecko/20031007';
$var[31] = 'MOT-';
$var[32] = 'UP.Link/';
$var[33] = 'Smartphone';
$var[34] = 'portalmmm/';
$var[35] = 'Nokia';
$var[36] = 'Symbian';
$var[37] = 'AppleWebKit/413';
$var[38] = 'UPG1 UP/';
$var[39] = 'RegKing';
$var[40] = 'STNC-WTL/';
$var[41] = 'J2ME';
$var[42] = 'Opera Mini/';
$var[43] = 'SEC-';
$var[44] = 'ReqwirelessWeb/';
$var[45] = 'AU-MIC/';
$var[46] = 'Sharp';
$var[47] = 'SIE-';
$var[48] = 'SonyEricsson';
$var[49] = 'Elaine/';
$var[50] = 'SAMSUNG-';
$var[51] = 'Panasonic';
$var[52] = 'Siemens';
$var[53] = 'Sony';
$var[54] = 'Verizon';
$var[55] = 'Cingular';
$var[56] = 'Sprint';
$var[57] = 'AT&T;';
$var[58] = 'Nextel';
$var[59] = 'Pocket PC';
$var[60] = 'T-Mobile';   
$var[61] = 'Orange';
$var[62] = 'Casio';
$var[63] = 'HTC';
$var[64] = 'Motorola';
$var[65] = 'Samsung';
$var[66] = 'NEC';

$result = count($var);

for ($i=0;$i<$result;$i++)
{   
    $ausg = stristr($text, $var[$i]);   
    if(strlen($ausg)>0)
    {
        header("location: $mobile");
        exit;
    }
   
}
?>


Just change the url of your mobile site in $mobile

That's all. You have done.;)

Thanks always goes to original script writers
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 10 posts
  • Votes 0 votes
  • Topic users 6 members

6 participants

Y
Y
younis 10
Steve Younis
Superman Homepage - http://www.SupermanHomepage.com
Christopher Reeve Homepage - http://www.ChrisReeveHomepage.com/
Steve's Stuff - http://www.younis.com.au/
  • Member, joined since
  • Contributed 86 posts on the community forums.
  • Started 28 threads in the forums
C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
G
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums
H
H
  • Member, joined since
  • Contributed 158 posts on the community forums.
  • Started 28 threads in the forums
  • Started this discussions
J
J
jekov 10
  • Junior Member, joined since
  • Contributed 26 posts on the community forums.
  • Started 1 thread in the forums
L
L
  • Junior Member, joined since
  • Contributed 14 posts on the community forums.
  • Started 4 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet