Created
January 5, 2018 20:40
-
-
Save stevewithington/056fc883e1acfe6e8a7808e70b88ac2b to your computer and use it in GitHub Desktop.
Mura Platform: Example Mobile Layout Template Using jQuery Mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfsilent> | |
<!--- | |
NOTE: Since the MuraBootstrap theme is a 'Responsive' framework, this layout is | |
completely optional. It uses jQuery Mobile (http://jquerymobile.com/) to display | |
content for handheld devices. | |
To use it, simply rename the file to 'mobile.cfm' | |
If you wish to see how it looks, simply append '/?mobileformat=1' to the end of the | |
URL. You could also add a link to your full site footer to allow people to view your | |
mobile site using something like: | |
<a href="./?mobileformat=1">Mobile Version</a> | |
This template uses the CDN scripts from jQuery Mobile. Of course, you could always | |
download the scripts and include them with your theme, if you prefer: | |
http://jquerymobile.com/download/ | |
---> | |
</cfsilent> | |
<cfoutput> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="description" content="#esapiEncode('html', $.getMetaDesc())#" /> | |
<meta name="keywords" content="#esapiEncode('html', $.getMetaKeywords())#" /> | |
<cfif len($.content('credits'))> | |
<meta name="author" content="#esapiEncode('html', $.content('credits'))#" /> | |
</cfif> | |
<meta name="generator" content="Mura CMS #$.globalConfig('version')#" /> | |
<meta name="robots" content="noindex, follow" /> | |
<title> | |
#esapiEncode('html', $.content('HTMLTitle'))# - #esapiEncode('html', $.siteConfig('site'))# | |
</title> | |
<link rel="icon" href="#$.siteConfig('assetPath')#/images/favicon.ico" type="image/x-icon" /> | |
<link rel="shortcut icon" href="#$.siteConfig('assetPath')#/images/favicon.ico" type="image/x-icon" /> | |
#m.outputMuraCSS(version='7.1', includeskin=false)# | |
<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> | |
<!--- Font Awesome ---> | |
<link rel="stylesheet" href="#$.siteConfig('themeAssetPath')#/assets/font-awesome/css/font-awesome.css"> | |
<!--- Theme-Specific Mobile CSS ---> | |
<!--- <link rel="stylesheet" href="#$.siteConfig('themeAssetPath')#/css/mobile/mobile.min.css"> ---> | |
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> | |
<script type="text/javascript"> | |
// because mobileinit is triggered immediately, we need to bind our event handler before jQM is loaded | |
$(document).on('mobileinit', function() { | |
// overrides | |
$.extend( $.mobile, { | |
ajaxEnabled: false | |
, pushStateEnabled: false | |
}); | |
}); | |
</script> | |
<script src="//code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> | |
<cfset rs=$.getBean('feedManager').getFeeds($.event('siteID'),'Local',true,true) /> | |
</head> | |
<body id="#$.getTopID()#" class="depth-#$.content('depth')# #$.createCSSHook($.content('menuTitle'))#"> | |
<!--- page ---> | |
<div data-role="page" data-theme="a"> | |
<!--- header ---> | |
<cfif $.content('isHome')> | |
<h1 id="site-title">#esapiEncode('html', $.siteConfig('site'))#</h1> | |
<cfelse> | |
<div data-role="header" data-position="inline" data-theme="a"> | |
<a href="##" id="btn-back" data-icon="arrow-l">Back</a> | |
<h1>#esapiEncode('html', $.siteConfig('site'))#</h1> | |
<div><a href="#$.createHREF(filename='')#" rel="external" data-role="button" class="ui-btn-right">#$.rbKey("mobile.home")#</a></div> | |
</div> | |
</cfif> | |
<!--- /header ---> | |
<!--- main ui-content ---> | |
<div role="main" class="ui-content"> | |
<!--- Page Title ---> | |
<cfif not $.content('isHome')> | |
<h2>#esapiEncode('html', $.content('title'))#</h2> | |
</cfif> | |
<!--- Body ---> | |
<cfif YesNoFormat($.content('hasMobileBody'))> | |
#$.dspBody(body=$.content('mobileBody'),pageTitle='',crumbList=0,showMetaImage=0)# | |
<cfelse> | |
#$.dspBody(body=$.content('body'),pageTitle='',crumbList=0,showMetaImage=0)# | |
</cfif> | |
<!--- Display Objects ---> | |
#$.dspObjects($.siteConfig('primaryColumn'))# | |
<cfif $.content('isHome')> | |
<!--- Mobile Primary Nav ---> | |
<cf_CacheOMatic key="dspMobilePrimaryNav#$.content('contentID')#"> | |
#$.dspPrimaryNav( | |
viewDepth=0 | |
, id="navPrimary" | |
, displayHome="never" | |
, closeFolders=true | |
, showCurrentChildrenOnly=false | |
)# | |
</cf_cacheomatic> | |
<cfelseif not listFindNoCase('Gallery,Portal', $.content('type'))> | |
<!--- Subnavigation ---> | |
<div id="navSub"> | |
#$.dspSubNav()# | |
</div> | |
</cfif> | |
</div> | |
<!-- /main ui-content --> | |
<!--- footer ---> | |
<div data-role="footer" data-theme="a" class="ui-bar"> | |
<a href="./?mobileFormat=false" rel="external"> | |
#$.rbKey("mobile.fullversion")# | |
</a> | |
</div> | |
<!--- /footer ---> | |
</div><!-- /page --> | |
<script> | |
$('body').on('pagebeforecreate', function(event, ui) { | |
// Primary Nav on Home Screen | |
$('##navPrimary').attr({ | |
'data-role': 'listview', | |
'data-inset': 'false', | |
'data-theme': 'a', | |
'data-dividertheme': 'b', | |
}); | |
// Secondary Nav | |
$('##navSub ul').attr({ | |
'data-role': 'listview', | |
'data-inset': 'false', | |
'data-theme': 'a', | |
'data-dividertheme': 'b' | |
}); | |
// $('div.mura-next-n').attr({ | |
// 'data-role': 'navbar' | |
// }); | |
// Back buttons | |
$('##btn-back').on('tap',function() { | |
history.back(); return false; | |
}).on('click',function() { | |
history.back(); return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> | |
</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment