1
mouacy
cell phone identifier / pda.php
  • 2004/11/7 10:51

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Hey guys, is there any special code that I can insert into the index.php file to identify if a person is accessing the site from a pda or cell phone to open the appropriate page for the device?

Everytime I want to read something off a XOOPS site, I always had to type mysite.com/pda.php to read the news. I want to be able to type just mysite.com and have the index.php open the pda.php by using identifier.

Someone who has the knowledge, please share with me.

2
Mithrandir
Re:cell phone identifier / pda.php

A brief googling revealed this:
if (preg_match("(UP|Windows CE|PPC|Palm|PDA|EPOC|MMP)",$_SERVER["HTTP_USER_AGENT"])) {

that presumably should detect this. I cannot test it, though, but see if it gets you nearer the goal.

3
mouacy
Re:cell phone identifier / pda.php
  • 2004/11/8 10:09

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Mithrandir, thank you for your help. Now I can read news and check my inbox using my cell phone when I'm away from a computer/w internet.


4
shank
Re:cell phone identifier / pda.php
  • 2005/2/7 18:17

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Can I get some more detail of how you did this?
Thanks,
Steve

5
Mithrandir
Re:cell phone identifier / pda.php

My guess is to put this at the top of xoops-root/index.php (right after the inclusion of mainfile.php):
if (preg_match("(UP|Windows CE|PPC|Palm|PDA|EPOC|MMP)",$_SERVER["HTTP_USER_AGENT"])) {
    
header('location: pda.php');
}

6
mouacy
Re:cell phone identifier / pda.php
  • 2005/2/7 20:46

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Shank, I edit the header.php file and place Mithrandir's code after the license note.

At the beginning before the line

include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';

Insert this code:
if (preg_match("(UP|Windows CE|PPC|Palm|PDA|EPOC|MMP)",$_SERVER["HTTP_USER_AGENT"]))
{
    
$URL XOOPS_URL.'/pda.php';
    
header ("Location: $URL");
    exit();
} else {


Leave the original code as is.

At the end, before ?>:
}


It works fine for me. I'm still working on the private messages to get the reply button to work. Now it uses java popup and cellphones don't use popup. So I have a bit of problem there. Reply doesn't work.

7
shank
Re:cell phone identifier / pda.php
  • 2005/2/7 23:06

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


What did you add to pda.php so you could login and check messages?


Why couldn't you edit readpmsg.php with your if statement so that if you are on a phone it opens in the same window?

8
mouacy
Re:cell phone identifier / pda.php
  • 2005/2/8 7:07

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Here are the files that I have hacked/modified to work with my cellphone browser.

There should be FOUR files:

pda.php
pdapm.php
pdareadpmsg.php
pdauser.php

You can only read your private messages. YOU CANNOT REPLY YET. I havenot had the time to work on the reply function.

Download athttp://www.nplaimhlub.com/downloads/files/pdapm.rar

Just unzip them and put them where your mainfile.php file is.
For this to work, you must have edit the header.php file as stated in all the previous posts.

Thanks.

9
WarDick
Re:cell phone identifier / pda.php
  • 2005/2/8 7:13

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


How do the themes work with this. Do we require a special theme if so how do we get it to work? This is a really nice addition to any web site thanks for sharing.

10
mouacy
Re:cell phone identifier / pda.php
  • 2005/2/8 7:20

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


I do not use theme in this package. Articles and messages are viewd as simple html text. You can add theme to the display but that would slow down the loading process and probably distort the display because cellphone has a small screen.

So no theme in this package.

To see how it looks:http://www.nplaimhlub.com/pda.php

Login

Who's Online

145 user(s) are online (80 user(s) are browsing Support Forums)


Members: 0


Guests: 145


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits