Page 1 of 3 123 LastLast
Results 1 to 15 of 36

Thread: After Mobile Redirect - View Full Site link

  1. #1
    Join Date
    Jun 2005

    After Mobile Redirect - View Full Site link

    I have a mobile redirect that works and points to a template mobile site. Now I need to bypass that and have the option to view the "Full Site" through a link on the mobile site. I've read the best way to do this is by setting a cookie, and found a site that gives example files to do this.


    The example works fine on my site, but when i try to integrate this with my joomla index.php it fails and I get multiple errors.

    Has anyone successfully done this with joomla or see how this code could be integrated? Or know of a better way to approaching this? Thanks for any help.

  2. #2
    Join Date
    Aug 2006
    Can't help with the cookie thing, but an alternative. I pass a parameter "mode" to my main site, and in the main site index.php file, if "mode" is present and = "desktop", I don't do the mobile redirect, and go right to the main site view. If mode="mobile" I jump right to the mobile site without checking, and if mode doesn't exist, I do the redirect check and do whatever it decides. Then on the mobile site, the link to the main site looks like "index.php?mode=desktop"


  3. #3
    Join Date
    Jun 2005
    Thanks, sounds like it could work for my setup. Do you have an example page that's using this that I could see the code your talking about? I'd really like not to use cookies if I don't have to just because people maybe not be set to accept them, so this sounds like it would be an even better solution.

  4. #4
    Join Date
    Aug 2006
    I don't have a page you can look at, but it's just something like this.

    Mobile site:
    <a href="http://www.mainsite.com/?mode=desktop">Jump to full site</a>
    Main site:
    PHP Code:
    $mode "mobile";
    $mode "desktop";
    $mode IsMobile() ? "mobile" "desktop";

    if (
    $mode == "mobile")
    header ("Location: http://www.mobilesite.com");

    // rest of main site goes here

  5. #5
    Join Date
    Jun 2005
    Thanks a lot! I'll try it out and see how it integrates with what I have setup.

  6. #6
    Join Date
    Jun 2005
    After placing that at the top of my index.php I get the following error from a normal browser.

    Fatal error: Call to undefined function: ismobile() in /nfs/c02/h07/mnt/17839/domains/mysite.com/html/index.php on line 11

    It seems like it's looking for that "mobile" or "desktop" in the link before it can go to the regular index.php

    If I go to http://mysite.com/index.php?mode=desktop it will go to the main page of my site, but then none of the links work...

    I'll keep messing with it, but if you see an easy fix let me know. This is out of my league, so I'm just trying to cut and paste what I see from other examples.

    Last edited by xover15; 01-31-2011 at 12:49 PM.

  7. #7
    Join Date
    Aug 2006
    "ismobile" is the call to your mobile checker, which you said you already had. You can call it whatever you want, I just happen to call mine ismobile. It needs to return true if the client is mobile.

    Just a note... it is quite dangerous to be using code from random sources on the internet without truly knowing what it does. PHP code has the ability to do absolutely anything to your site, and if you're not thoroughly reading through and understanding it, you are placing a fair bit of faith in the source it came from. That includes code from me, by the way.


  8. #8
    Join Date
    Jun 2005
    gotcha, thanks for the warning.

  9. #9
    Join Date
    Apr 2011
    tracknut, thanks for the code. I tried it on my mobile site and it works. But I have the same problem as xover15, when you go to main site from mobile site, page links on the main site do not work, it sends you back to the mobile site. Any idea on how to fix that?

  10. #10
    Join Date
    Aug 2006
    Quote Originally Posted by nailyener View Post
    Any idea on how to fix that?
    Not without seeing your code...


  11. #11
    Join Date
    Apr 2011
    Here is the PHP code on my main site's index.php:

    function is_mobile(){
    	$regex_match.="symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|";
    	$regex_match.="jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220";
    	return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT']));
    case 'mobile':
        $mode = "mobile";
    case 'desktop':
        $mode = "desktop";
        $mode = is_mobile() ? "mobile" : "desktop";
    if ($mode == "mobile")
        header ("Location: http://mobile.mainsite.com/");
    And I use

    <a href="http://www.mainsite.com/?mode=desktop">Full Site</a>
    on the mobile site. By the way the extension of my mobile site's pages are .html

  12. #12
    Join Date
    Aug 2006
    And what's an example of one of the page links on the main site that inappropriately links you back to the mobile site? Is this code live somewhere we can see it?


  13. #13
    Join Date
    Apr 2011
    Quote Originally Posted by tracknut View Post
    And what's an example of one of the page links on the main site that inappropriately links you back to the mobile site? Is this code live somewhere we can see it?

    Surely, the site is neonstring.com and the mobile version is m.neonstring.com. The (main site) pages that don't work properly on mobile device have this parameter "?tasket=...".

    Thank you very much for your interest Dave.

  14. #14
    Join Date
    Aug 2006
    Can you point me to one of the specific links that fails? I'm clicking away on the links in the main (desktop) site, and haven't been redirected to the mobile site once...


  15. #15
    Join Date
    Apr 2011
    Are you checking on a mobile device?

    neonstring.com works fine as it should on a desktop browser. When you go "neonstring.com" on a mobile device, it redirects to "m.neonstring", that's good. Then, when I click on the "Full Site" link, it redirects to "neonstring.com", that's also good. But, when I click on the "Photos", "Videos", "About Us", etc. links they redirect back to "m.neonstring", that's not good.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11112 seconds
  • Memory Usage 3,016KB
  • Queries Executed 15 (?)
More Information
Template Usage (38):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (15)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (15)postbit
  • (15)postbit_onlinestatus
  • (15)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (74):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates