How do i load different views? |
It seems to me that your code is working fine: BUT
Your first if statement is asking: Code: if($this->detect->isMobile() || $_SERVER['HTTP_HOST'] === MOBILE_URL){ Which is Quote:if ((I detect it is a mobile device) OR (The url is a mobile url)) { then give mobile content } But, on your PC you fail the first test, but since you are using a mobile url, you pass the second test. If you are suggesting that, on a PC, if I use the mobile url, I should get PC content, (which I do not think is right) you should recode it to do something like: Quote:If (I detect it is a mobile device) { give mobile content } I am making lots of assumptions about how you are detecting a mobile device, but the url only comes into play if it cannot detect the device type. This is a waste of time though. I would always give mobile content if a mobile url is being used, whatever the device, just as you are currently doing. Best wishes Paul
Thanks for your reply and suggestion.
In fact what i want to achieve is: 1) show me mobile contents when i use mobile device or visit mobile url with a pc 2) show me pc contents when i visit with a pc on main domain url.
Be Simple
What results do you get when you output the results from
Code: $this->detect->isMobile() Code: $_SERVER['HTTP_HOST'] === MOBILE_URL If both are correct then the prob will be with set('base_url') Paul.
Just because you can detect mobile usage doesn't mean you should. It is far better to use a CSS responsive web page.
The reasons for this assumption is because there are far too many screen sizes, far better to not use fixed widths and to make the web page fluid. Search for "Google Mobile Friendly", submit you web page and follow the help to eliminate conflicts. Easier to maintain a common web page rather than trying to cater for numerous screen sizes and resolutions. (03-27-2016, 07:44 AM)PaulD Wrote: What results do you get when you output the results from On PC Code: $this->detect->isMobile() and Code: $_SERVER['HTTP_HOST'] === MOBILE_URL I think i'm finding a fix. When it works i'll let you guys know about it.
Be Simple
(03-27-2016, 05:47 PM)John_Betong Wrote: Just because you can detect mobile usage doesn't mean you should. It is far better to use a CSS responsive web page. i don't like responsive design because i am bad at css. In fact i don't like it at all.
Be Simple
You should try bootstrap css or materialize css, both have good grid system & nice documentation.
Keep calm.
I got it fixed.
Code: if($_SERVER['HTTP_HOST'] = MOBILE_URL){
Be Simple
|
Welcome Guest, Not a member yet? Register Sign In |