Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [Jesus] Mobile template

Quote Reply
Re: [Jesus] Mobile template In reply to
Hi,

The problem with Javascript, is that it has to load the page first - to run the code. So what you are in fact doing, is loading the NORMAL page first, and then re-directing to the new mobile version.... so that would be pretty slow. If you are using "real" static files, then it may be worth looking at some rewrite rules in a .htaccess file to do the magic:

http://ohryan.ca/...te-rules-simplified/

So something like:

Code:
RewriteEngine On

# if the browser accepts these mime-types, it's definitely mobile, or pretending to be
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR]
# a bunch of user agent tests
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC]
RewriteRule ^(.*)$ http://m.yoursite.com/$1 [R=302,L]

Then setup that sub-domain on your site, and create the following extra mod_rewrite rules in that new sub-domain:

Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|js|css|xml|png|php|cgi|pl|JPG|GIF|BMP|flv|swf|xml)$
RewriteRule ^(.*).html /full/path/to/live/site/cgi-bin/page.cgi?g=$1.html;t=mobile [L]

RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|js|css|xml|png|php|cgi|pl|JPG|GIF|BMP|flv|swf|xml)$
RewriteRule ^(.*).cgi /cgi-bin/$1.cgi?$1;t=mobile [L]

Totally untested, but hopefully it will get you on the right track. I can't really offer much more help, apart from doing it as a paid job Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Mobile template Jesus 14197 Nov 8, 2011, 9:59 AM
Thread Re: [Jesus] Mobile template
Andy 14033 Nov 8, 2011, 10:29 AM
Thread Re: [Andy] Mobile template
Jesus 14028 Nov 8, 2011, 10:38 AM
Thread Re: [Jesus] Mobile template
Jesus 14024 Nov 8, 2011, 10:41 AM
Thread Re: [Jesus] Mobile template
Andy 14096 Nov 8, 2011, 11:17 AM
Thread Re: [Andy] Mobile template
Jesus 14002 Nov 8, 2011, 11:28 AM
Thread Re: [Jesus] Mobile template
Jesus 14009 Nov 8, 2011, 11:34 AM
Post Re: [Jesus] Mobile template
Andy 14033 Nov 9, 2011, 1:10 AM
Thread Re: [Jesus] Mobile template
Andy 13946 Nov 9, 2011, 11:24 AM
Thread Re: [Andy] Mobile template
Jesus 13944 Nov 9, 2011, 11:28 AM
Thread Re: [Jesus] Mobile template
Andy 14008 Nov 9, 2011, 11:31 AM
Thread Re: [Andy] Mobile template
Jesus 13935 Nov 9, 2011, 11:36 AM
Thread Re: [Jesus] Mobile template
Andy 13971 Nov 10, 2011, 12:59 AM
Thread Re: [Andy] Mobile template
Jesus 13914 Nov 10, 2011, 6:32 AM
Thread Re: [Jesus] Mobile template
Andy 14008 Nov 10, 2011, 6:36 AM
Thread Re: [Andy] Mobile template
Jesus 13958 Nov 10, 2011, 7:11 AM
Thread Re: [Jesus] Mobile template
Andy 13964 Nov 10, 2011, 7:14 AM
Thread Re: [Andy] Mobile template
Andy 13988 Nov 10, 2011, 7:24 AM
Post Re: [Andy] Mobile template
Jesus 13905 Nov 10, 2011, 7:30 AM