Taking Your Website Mobile with TYPO34. I live in Dallas with my
beautiful wife,
Rebekah.
5. I live in Dallas with my
beautiful wife,
Rebekah.
We have a dog.
7. 45678)4-#,29'-1
-1
#& )*0%&&
%*($-B&
& :;9')("$)>&22)2-9.%)?."#)';&1)<""=
0D& 4+%#&
& !& O>+/(&(-'$)+5&$'(&.*1#",>/&39:;<&%#)./$%#0&
E5+#'%/-&
& >0+'?&3-.*45"+.%B&3#)./$6*+/$B&$'(&*%2#"&5*"#&
(& )*"#&& %#52'*/*?+#0&
!& !>0%*)+G#&(-'$)+5&)#'>0B&/*?*0B&$'(&
)+G+'?&& 2#$(#"0&>0+'?&%"+5=0&-*>&1*'K%&E'(&+'&%2#&&
$+/$A/#D&
*,E5+$/&(*5>)#'%$%+*'&
)./#& %*&&
*45"+.%B&& !& O>+/(&5*'%#'%&#/#)#'%0&$'(&%#)./$%#&
#C%#'0+*'0&%*&*@#"2$>/&$'(&+)."*@#&&
39:;<K0&(#,$>/%&A$5=H#'(&#(+%+'?&#C.#"+#'5#
C$)./#&
>"& *1'& !& N((&(-'$)+5&A$''#"0&$'(&/*?*0&%*&$'&#C+0%+'?&
#D&9*>& %#)./$%#&(#0+?'
?$%+*'B&
0&+'&%2#& !& !"#$%#&5>0%*)&)#'>0&>0+'?&)>/%+./#&
)./$%#0& $.."*$52#0&$'(&%#52'+F>#0 ! " # # $ % & ' ( ) * + , - . & - % / - ) 0 & 1 ' & 2 2 - 3
*>&1+//&
*'$/+G#& !& !"#$%#&)>/%+./#&%#)./$%#0&1+%2*>%&
"#.#$%+'?&-*>"0#/,
!& !>0%*)+G#&%2#&A$5=#'(&#(+%+'?&#C.#"+#'5#&
7#"#)-&8"##'$1$/%
,*"&0.#5+E5&%#)./$%#0
45678)4-#,29'-1
$'%0&%*&
)>/%+./#& !& N((&)>/%+./#&5*/>)'0&$'(&0.#5+$/&,*")$%%+'?&
#B&%2#'& 1+%2&Q#C+A/#&5*'%#'%&#/#)#'%0
(&>0#"0& !& !"#$%#&.*1#",>/&5*'%#'%&#/#)#'%0&1+%2&
#(+%+'?& @$"+$A/#0&$'(&+'%#//+?#'%&,*")$%%+'?
@)ABCBB)L4 !"#$%#&$'(&)*(+,-&%#)./$%#0&1+%2&3-.*45"+.%&$'(&3#)./$6*+/$
D)8ECBB)LM
:"+5#0&(*&'*%&+'5/>(#&
/*5$/&0$/#0&%$C&*"&6N3&
12#"#&$../+5$A/#
?B&O+")+'?2$)&H&P>)A$+
9/='6$<C/"# F-.-#()G.--%9>92'
11. What We’re
Talking About:
•How much do you optimize for mobile
devices?
•Mobile best practices
•Four basic paths to mobile devices using CSS,
TypoScript, and TemplaVoila.
12. How much do you
optimize for mobile
devices?
Mobile design happens on a spectrum.
20. Mobile Users:
•Have a smaller screen
•Have limited bandwidth
•Need different information
•Need everything faster
•Don’t have keyboards or mice
23. Simplify Navigation
•Reduce menus to the minimum # of items.
•Highlight the menu items that people need
in a mobile context.
•Don’t rely on hover or drop-down behavior.
36. Fluid Grids
http://www.designinfluences.com/fluid960gs/
38. Flexible Images
img,object { max-width: 100%; }
Internet Explorer:
img { width: 100%; }
http://unstoppablerobotninja.com/entry/fluid-images/
40. Single CSS Stylesheet
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
"Hardboiled CSS3 Media Queries" by Andy Clarke
http://stuffandnonsense.co.uk/blog/about/
hardboiled_css3_media_queries
44. Pros
•Can be a great starting place
•Adaptable for screens of all sizes
45. Cons
•Introduces a whole new design process
•Not a complete “mobile solution”
•Still downloads large content
•No way to see full desktop site
50. Example Condition
[browser = msie]
page.headerData.30.value = <link rel="stylesheet"
type="text/css" href="fileadmin/templates/
common_ie.css">
[else]
page.headerData.30.value = <link rel="stylesheet"
type="text/css" href="fileadmin/templates/common.css">
[end]
52. What is a useragent
string?
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0
like Mac OS X; en-us) AppleWebKit/532.9
(KHTML, like Gecko) Version/4.0.5
Mobile/8A293 Safari/6531.22.7
53. What is a useragent
string?
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0
like Mac OS X; en-us) AppleWebKit/532.9
(KHTML, like Gecko) Version/4.0.5
Mobile/8A293 Safari/6531.22.7
57. Adding a user function
to localconf.php
function mobile_check($cmd){
switch($cmd){
case "appleDevices":
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') ||
strstr($_SERVER['HTTP_USER_AGENT'],'iPod') ||
strstr($_SERVER['HTTP_USER_ AGENT'],'iPad')) {
return true;
}
break;
case "androidDevices":
// ....
break;
}
}
61. Mobile Stylesheet
/* Resize all fonts for mobile devices */
p, ul, div, h2, h3, h4, h5, h6 {
font-size: 24px;
line-height: 30px;
}
/* Resize menu items for mobile devices */
li.menu-item a {
font-size: 30px;
line-height: 36px;
margin-right: 10px;
}
/* Reset all columns to 100% width and single-column */
#column_1, #column_2 {
float: none;
width: 100%;
}
62. Load CSS with TypoScript
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent =
*Android*]||[useragent = *Opera Mini*]||[useragent =
*BlackBerry*]
page.headerData.30 = TEXT
page.headerData.30.value = <link rel="stylesheet"
type="text/css" href="fileadmin/templates/css/mobile.css" />
[end]
65. Updating an image
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent =
*Android*]||[useragent = *Opera Mini*]||[useragent = *BlackBerry*]
page.headerData.30 = TEXT
page.headerData.30.value = <link rel="stylesheet" type="text/css"
href="fileadmin/templates/css/mobile.css" />
lib.logo.file = fileadmin/templates/logo_mobile.png
lib.mainMenu >
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 0
wrap = <ul id="menu-area">|</ul>
1 = TMENU
1.NO.allWrap = <li class="menu-item">|</li>
}
[end]
66. Updating an image
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent =
*Android*]||[useragent = *Opera Mini*]||[useragent = *BlackBerry*]
page.headerData.30 = TEXT
page.headerData.30.value = <link rel="stylesheet" type="text/css"
href="fileadmin/templates/css/mobile.css" />
lib.logo.file = fileadmin/templates/logo_mobile.png
lib.mainMenu >
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 0
wrap = <ul id="menu-area">|</ul>
1 = TMENU
1.NO.allWrap = <li class="menu-item">|</li>
}
[end]
67. Bring it all together
[useragent = *iPhone*]||[useragent = *iPod*]||[useragent =
*Android*]||[useragent = *Opera Mini*]||[useragent = *BlackBerry*]
page.headerData.30 = TEXT
page.headerData.30.value = <link rel="stylesheet" type="text/css"
href="fileadmin/templates/css/mobile.css" />
lib.logo.file = fileadmin/templates/logo_mobile.png
lib.mainMenu >
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 0
wrap = <ul id="menu-area">|</ul>
1 = TMENU
1.NO.allWrap = <li class="menu-item">|</li>
}
[end]
69. Adding a Link to the
Desktop Version
Some people still want the whole experience.
71. Set the link variable
config.linkVars = full
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent =
*iPod*] && [globalVar = GP:full<1] || [useragent = *Android*] &&
[globalVar = GP:full<1] || [useragent = *Opera Mini*] &&
[globalVar = GP:full<1] || [useragent = *BlackBerry*] &&
[globalVar = GP:full<1]
## Mobile information
lib.footerLink {
value = Full Version
typolink {
parameter.data = page:uid
addQueryString = 1
addQueryString.exclude = id
additionalParams = &full=1
}
}
[end]
72. Check global variables
config.linkVars = full
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent =
*iPod*] && [globalVar = GP:full<1] || [useragent = *Android*] &&
[globalVar = GP:full<1] || [useragent = *Opera Mini*] &&
[globalVar = GP:full<1] || [useragent = *BlackBerry*] &&
[globalVar = GP:full<1]
## Mobile information
lib.footerLink {
value = Full Version
typolink {
parameter.data = page:uid
addQueryString = 1
addQueryString.exclude = id
additionalParams = &full=1
}
}
[end]
73. Add link to full site
config.linkVars = full
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent =
*iPod*] && [globalVar = GP:full<1] || [useragent = *Android*] &&
[globalVar = GP:full<1] || [useragent = *Opera Mini*] &&
[globalVar = GP:full<1] || [useragent = *BlackBerry*] &&
[globalVar = GP:full<1]
## Mobile information
lib.footerLink {
value = Full Version
typolink {
parameter.data = page:uid
addQueryString = 1
addQueryString.exclude = id
additionalParams = &full=1
}
}
[end]
74. Bring it all together
config.linkVars = full
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent =
*iPod*] && [globalVar = GP:full<1] || [useragent = *Android*] &&
[globalVar = GP:full<1] || [useragent = *Opera Mini*] &&
[globalVar = GP:full<1] || [useragent = *BlackBerry*] &&
[globalVar = GP:full<1]
## Mobile information
lib.footerLink {
value = Full Version
typolink {
parameter.data = page:uid
addQueryString = 1
addQueryString.exclude = id
additionalParams = &full=1
}
}
[end]
77. Mobile HTML
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="logo"></div>
<ul id="menu-area">
<li class="menu-item"><a href="">Menu Item</a></li>
</ul>
<div id="content">This is our content</div>
<div id="print_link"></div>
</body>
</html>
82. TypoScript Setup
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent =
*iPod*] && [globalVar = GP:full<1] || [useragent = *Android*] &&
[globalVar = GP:full<1] || [useragent = *Opera Mini*] && [globalVar =
GP:full<1] || [useragent = *BlackBerry*] && [globalVar = GP:full<1]
page.10.childTemplate = mobile
## The rest of our mobile code
[end]
85. “...if the user goals for your mobile site are
more limited in scope than its desktop
equivalent, then serving different content
to each might be the best approach.”
Ethan Marcotte
http://m.alistapart.com/articles/responsive-web-design/
86. TypoScript Redirect
[useragent = *iPhone*] && [globalVar = GP:full<1] || [useragent
= *iPod*] && [globalVar = GP:full<1] || [useragent = *Android*]
&& [globalVar = GP:full<1]
config.additionalHeaders = Location: m.example.com
[end]
[useragent = *Opera Mini*] && [globalVar = GP:full<1] ||
[useragent = *BlackBerry*] && [globalVar = GP:full<1]
## Generic mobile code goes here
[end]
Editor's Notes \n T\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n