mobile site redirect to full site

Greetings new here and to PHP

I have included the code from mobile_detect.php into a site project i am attemping for my son. The code works very well and redirect to a mobile site with no problem. I now need to add a link to the mobile site to enable the full site to be displayed if requested. I have tried a variety of suggestions from all sources without success. Can anyone point me in the right direction.

Thanks

P

Why bother making two separate websites when you can just make ONE responsive site?

What he said. Sites should be responsive from design phase, in fact Google penalizes non responsive sites to get away from mobile redirection of yesteryear.

Thanks for your replies, though less than helpful.

I have not made a responsive type before and the request I received was for two sites. I know this can be done in PHP but do not have the knowledge to do it myself. I thought I would join a recommended forum of professional guys to help, assist or point me in the right direction. It appears you have no wish to pass on any information about PHP. So sad… :’(

I am a retired person who is trying to learn abit about a new skill that will hopefully occupy some of my free time and give me a little feeling satisfaction from understanding or learning something new.

Was this the wrong forum to join ?

Internet communities often come off as harsh and uninviting - I don’t think there are much difference between this forum and others in that regard.

When helping out answering questions we often come across a typical kind of user. One who follows outdated practises and don’t care about updating himself and his code to modern standards (which can often mean 10+ year old standards). After some time this gives many people a kind of rough edge for questions like this.

Hopefully you can see past the “rudeness” of the internet, and appreciate that most people actually do contribute with some kind of constructive feedback. Often when you have a problem the problem itself may be the issue, and avoiding the problem alltogether is a better solution that actually trying to fix it. If that makes sense.

Regarding your current issue you will have to either rewrite the site (as mentioned before) to modern standards. This will probably involve quite a bit of “front end” work, meaning potentially rewriting the HTML and CSS to be responsive (fit all screens). Many use a framework, like bootstrap to ease the work - and at the same time get a lot of front end components that work well together.

Keeping the site as is - is ofcourse also an option. Then you will to circumvent the mobile detect script so you can force the site to be in desktop mode. It’s hard to offer any sort of real advise without seeing any code, but as an example solution you may do something like this:

index.php
[php]<?php

include ‘mobile_detect.php’;

// code for your desktop site[/php]

[hr]

Then allow us to force desktop mode.

[php]<?php

if (!isset($_GET[‘desktop’])) {
include ‘mobile_detect.php’;
}

// code for your desktop site[/php]

You can now link to index.php?desktop to show the desktop site

[hr]

A better option may be to store the choice in session

[php]<?php
session_start();

$_SESSION[‘desktop’] = isset($_SESSION[‘desktop’]) || isset($_GET[‘desktop’]);

if (!$_SESSION[‘desktop’]) {
include ‘mobile_detect.php’;
}

// code for your desktop site[/php]

The choice will be persisted throughout the session even if the variable is lost from the url.

Thank you JimL I totally understand what you are saying. Time willing I would love to try to build a responsive solution. My age and other problems mean I am a little slower learning new skills these days.

Thank you for your response to my plea I shall attempt to incorporate your script or a variation on them in the hope of some success

P

Yes, I agree with everyone! I would look into the Bootstrap link JimL gave you. It is fairly easy to use once you learn the
rows and cols layout which is quite easy. It can be made to auto-change the site to fit iPhones, iPads, etc without any work
done by you. Better than having two sites.

But, you could also just place a simple link to the other site on the page.

Thanks for that. I shall look into the Bootstrap thing when I get a chance.

I’m not intirely sure what you mean by you can place a simple link on the page.

What page. What sort of link. Are we now talking about bootstrap.??

Getting really confused

Pretty sure he means the “view this site as desktop” link we’ve discussed :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service