*Would it be possible to generalise web2py templates in order to allow for the following use-cases?*
- PhoneGap <http://phonegap.com/> built mobile-app (JavaScript, HTML and CSS) using JSONRPC - Main website (this use-case is catered for) - JavaScript "widget" code for pasting onto your site, popular examples: - DISQUS <http://disqus.com> gives the following snippet: - <script type="text/javascript" src= "http://example.disqus.com/combination_widget.js?num_items=5&hide_mods=0&color=blue&default_tab=people&excerpt_length=200" ></script><a href="http://disqus.com/">Powered by Disqus</a> - Facebook <http://www.facebook.com> gives the following snippet: - <div id="fb-root"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=237216179703726" ;fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script> - <div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div> - Twitter <http://twitter.com> gives the following snippet: - <script charset="utf-8" src= "http://widgets.twimg.com/j/2/widget.js"></script><script>new TWTR. Widget({version: 2,type: 'profile',rpp: 4,interval: 30000,width: 250,height: 300,theme: {shell: {background: '#333333',color: '#ffffff'},tweets: {background: '#000000',color: '#ffffff',links: '#4aed05'}},features: {scrollbar: false,loop: false,live: false, behavior: 'all'}}).render().setUser('twitter').start();</script> My current plan is to write the entire client using HTML, CSS ( twitter-bootstrap <http://twitter.github.com/bootstrap/> responsive) and JavaScript—e.g.: with Backbone.js <http://backbonejs.org/>—allowing me to use that same client code for the website and PhoneGap clients. With that done, the widgets wouldn't be too difficult to generate. However, this seems like a really complex way of doing things, especially when taking into consideration checks requiring login, forced redirects and more fine grained RBAC like: @auth.requires_membership('agents'). *Is there a way to generalise web2py templates to cater to these aforementioned use-cases?* Thanks for all information and suggestions, Alec Taylor

