I am using the ThemeKey module to change the theme for mobile users. I have a custom View Mode called Mobile to display different content. I would like to have when my mobile theme is loaded for the node to use the Mobile View Mode that I created instead of the Default View Mode.
I would like to do this in the theme. Either hooking into the theme with a module or just placing the php in a template override.
Thanks!
Ok I found a few items that get my closer to what I am needing. I just can't seem to get it to work. I am testing this idea with the teaser for now.
<?php
$rendered_teaser = render(node_view(node_load($nid), 'teaser'));
?>
By using the node number I am able to get it to print in the page.tpl.php file fine. But I am wanting to get the node I am on and convert the view mode from full to teaser.
<?php
$rendered_teaser = render(node_view(node_load(2), 'teaser'));
?>
I found that information be reading the links below. I am still not able to get it to work but close. For some reason I get errors. I think it has to do with me placing it in the node.tpl.php and the page.tpl.php template file.
http://drupal.org/node/985022 http://drupal.stackexchange.com/questions/36028/getting-the-auto-summary-from-a-node-bodyhttp://drupal.stackexchange.com/questions/23961/print-result-of-a-node-load
And I got it working. Any comments appreciated. I placed this on the top of the page.tpl.php.
<?php
$nid = $node->nid;
if ($nid) {
$nid = $node->nid;
$rendered_view = node_view(node_load($nid), 'teaser');
}
?>
And I placed the print rendered_teaser where I wanted the node view to be printed.
<?php
if ($nid) {
print render($rendered_view);
}
else {
print render($page['content']);
}
?>