7 Replies - 324 Views - Last Post: 27 January 2013 - 01:55 PM

#1 AceKYD  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 01-July 12

Creating A Mobile Optimised Website

Posted 24 January 2013 - 05:08 PM

Hey guys... I wanna create a website using basically html, css and php... I normally use cms but this is actually the first time i wanna code a website from scratch, writing my own codes... my problem now is i dunno really know how to design the mobile version... What i mean is The same site.... But has different views on mobile and pc..... Any hints?

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Creating A Mobile Optimised Website

#2 NathanMullenax  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 83
  • View blog
  • Posts: 176
  • Joined: 23-September 12

Re: Creating A Mobile Optimised Website

Posted 24 January 2013 - 07:35 PM

There's some useful information about device detection at Stack Overflow here:

http://stackoverflow...evice-in-jquery

And probably elsewhere as well. Before all of that, I would code all business logic. Like, all of your table querying and whatnot should be as independent as possible from the presentation of data. Have you ever heard of 'Model, View, Controller'?

Also: Opera mobile emulator (or alternatively, some Firefox plugin that does the same thing) is useful for testing your page at a bunch of different resolutions.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#3 AceKYD  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 01-July 12

Re: Creating A Mobile Optimised Website

Posted 24 January 2013 - 09:41 PM

Haven't really heard of all that.... I have the opera emulator..... I was hoping i could do this with something like a if statement in Php
Was This Post Helpful? 0
  • +
  • -

#4 NathanMullenax  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 83
  • View blog
  • Posts: 176
  • Joined: 23-September 12

Re: Creating A Mobile Optimised Website

Posted 24 January 2013 - 09:49 PM

View PostAceKYD, on 24 January 2013 - 09:41 PM, said:

I was hoping i could do this with something like a if statement in Php

You could, actually. Just examine $_SERVER['HTTP_USER_AGENT'] in you PHP scripts and serve different markup based on what it contains. Unfortunately, that string is going to need to be processed before you can usefully do an 'if' or a 'switch'.

For example, here's what mine contains:
Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17

Ooh. I should have known. One of PHP's billions of functions does this parsing for you:
$browser = get_browser(null, true);
print $browser['platform'];


More information here:
http://php.net/manua...get-browser.php

This post has been edited by NathanMullenax: 25 January 2013 - 07:14 AM

Was This Post Helpful? 1
  • +
  • -

#5 AceKYD  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 01-July 12

Re: Creating A Mobile Optimised Website

Posted 24 January 2013 - 10:52 PM

Thanks NathanMullenax.... I'll get back here if i stumble upon anything
Was This Post Helpful? 0
  • +
  • -

#6 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: Creating A Mobile Optimised Website

Posted 27 January 2013 - 01:19 AM

is recommending device detection REALLY the best way to go about this? There is much intricacy to this topic.

personally, I stand my ground on using media queries and feature detection handle all of the UI layout. this feels like a much better way to separate concerns.
Was This Post Helpful? 0
  • +
  • -

#7 AceKYD  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 33
  • Joined: 01-July 12

Re: Creating A Mobile Optimised Website

Posted 27 January 2013 - 11:06 AM

I dont really get you... The Architect 2.0, could you explain better?
Was This Post Helpful? 0
  • +
  • -

#8 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: Creating A Mobile Optimised Website

Posted 27 January 2013 - 01:55 PM

you're going to want to looking for 'responsive design' and 'moderizr':

http://alistapart.co...sive-web-design

http://modernizr.com/


basically, it's saying you should target a CLASS of device instead of the device itself. eg, target smartphones rather than iphones and android phone separately. After all, you don't target 'DELL computers' and 'HP computers' separately do you?

feature detection is what makes up for the unfortunate reality that not all browsers are equally fully-featured. modernizr is the principle tool that web programmers use for feature detection. we would LIKE to use the best solution for a given layout problem, but if we can detect that that technique won't work on a given browser, we can use an alternative method instead.


obviously, there's no way to explain much of anything in two short paragraphs, you're going to need to keep asking questions and googling around.

This post has been edited by The Architect 2.0: 27 January 2013 - 01:56 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1