<?php
//template.php
// Add a single suggestion for nodes that have the "Promoted to front page" box checked.
function drop_preprocess_node(&$variables) {
if ($variables['promote']) {
// looks for node--promoted.tpl.php in your theme directory
$variables['theme_hook_suggestion'] = 'node__promoted';
}
}
// Add multiple suggestions for pages based on the logged in user's roles.
function drop_preprocess_page(&$variables) {
global $user;
if (!empty($user->roles)) {
foreach ($user->roles as $role) {
$filter = '![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s';
$string_clean = preg_replace($filter, '-', drupal_strtolower($role));
// looks for page--[role].tpl.php in your theme directory
// ex: page--administrator.tpl.php
$variables['theme_hook_suggestions'][] = 'page__'. $string_clean;
}
}
}
?>