Hi,
Does anyone know if its possible to make the Mobile Template Switcher (http://modxcms.com/extras/package/591) use multiple ’mobile specific / targeted’ templates? The current setup allows you to sniff the browser and if a mobile device forces the page content to use a template called ’mobile’ I was wondering if on specific pages you could force this to load a ’mobile_page2’ template and in effect have multiple page templates for mobile? (ideally this would be done by a TV on each page where we can specify the mobile template to use just as you can for the full desktop templates)
I have worked with Everett99 on getting this version of the plugin working nicely to allow a site to be viewed in either desktop or mobile mode, but this has a hardcoded mobile template which clads every page for mobile delivery - what we are after now is a version which could be adapted from here - http://modxcms.com/extras/package/591 to allow each page to specify its own unique mobile template and not mean all the pages in the mobile view of the site all have the same template...
Anyone got any ideas???
Many thanks
dubbs.
<?php $option = isset( $option ) ? $option : 'default'; $tpl['iphone1']= <<<TPL <html> template 1 </html> TPL; $tpl['iphone2']= <<<TPL <html> template 2 </html> TPL; $tpl['default']= <<<TPL <html> default mobile template </html> TPL; print $tpl[$option]; ?>
<mobile> [!template?option=`[*TemplateOption*]`!] </mobile>
<?php
$option = isset( $option ) ? $option : 'default';
$tpl['iphone1']= $modx->getChunk("iphone1");
$tpl['iphone2']= $modx->getChunk("iphone2");
$tpl['default']= $modx->getChunk("default");
print $tpl[$option];
?>
<mobile> <body class="narrow"> </mobile> <standard> <body class="huge"> </standard>
iphone1==1||iphone2==2||default==3
<?php
$option = isset( $option ) ? $option : '3';
$tpl['1']= $modx->getChunk("iphone1ChunkName");
$tpl['2']= $modx->getChunk("iphone2ChunkName");
$tpl['3']= $modx->getChunk("defaultChunkName");
print $tpl[$option];
?>
As I said in an earlier thread the ideal would be to leave the plugin as it is and just change the hard-coded Mobile Template="mobile" paramater to read a dynamic value from a Template Variable so in essence make it read Mobile Template="{*MobileTemplateTV*]" but this does not work....
Is it possible to pass anything into a plugin configuration setting? Template Variables do not seem to work... :[