Is it possible at all to create a node template file based on a specific field value?
For example I already have a node template file called "node--video.tpl.php" for nodes of content type video. I would now like to add a checkbox field in that content type.
If the box is unchecked then it will use the above template.
If the box is checked then it will use a different template.
UPDATE: I added the following to my template file as Mohammed suggested, but I am not getting the changes.
function motg_preprocess_node(&$vars) {
$node = $vars['node'];
if($node->field_solo[0]['value'] == 1)
{
$vars['theme_hook_suggestion'] = 'node__solo';
} else
{
$vars['theme_hook_suggestion'] = 'node__video';
}
}
My field "field_solo" is correctly outputting a value of 0 or 1 also.