1st step.
Create a new file called mobiledetect.js and place it in your root forum:
- function detectMobile() {
- if (document.cookie.indexOf("mobile_redirect=false") < 0) {
- if (!navigator.userAgent.match(/Opera/i)) {
- if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
- if (confirm("This site has an specific template foro iPhone uses. Click OK to view.")) {
- document.cookie = "mobile_redirect=false";
- window.location = "./mobile.php?lofi=1";
- } else {
- setMobileCookies();
- }
- } else if(navigator.userAgent.match(/android/i)) {
- if (confirm("This site has an specific template for Android users. Click OK to view.")) {
- document.cookie = "mobile_redirect=false";
- window.location = "./mobile.php?lofi=1";
- } else {
- setMobileCookies();
- }
- } else if((navigator.userAgent.match(/Symbian/i)) || (navigator.userAgent.match(/Nokia/i))) {
- if (confirm("This site has an specific templare foro Nokia uses. Click OK to view.")) {
- document.cookie = "mobile_redirect=false";
- window.location = "./mobile.php?lofi=1";
- } else {
- setMobileCookies();
- }
- }
- }
- }
- }
- function setMobileCookies() {
- var date = new Date();
- var days = 60;
- date.setTime(date.getTime()+(days*24*60*60*1000));
- var expires = "; expires="+ date.toGMTString();
- document.cookie = "mobile_redirect=false" + expires;
- }
- detectMobile();
2nd step.
Open templates/default/overall_header.tpl
search for
After add
3rd step.
Login as admin and go to CMS system.
Go to "Personal Pages" and create a new one called "mobile.php" based upon 2column.tpl
4th step
Edit the just created "mobile" page and add the blocks you wish. In my case I only use one "News" block.
That's all.
You can see how it works (if you have iPhone, android or Nokia) at http://www.ka-tet-corp.com/portal2.0/
Tchüss!!!