Skip to content

Instantly share code, notes, and snippets.

@isramv
Last active August 29, 2015 14:19
Show Gist options
  • Save isramv/59a3669e1eabd98ed8e5 to your computer and use it in GitHub Desktop.
Save isramv/59a3669e1eabd98ed8e5 to your computer and use it in GitHub Desktop.
How to theme a block Drupal 7 example
/**
* Function
*/
function myfunction() {
$variables = array(
'message' => 'Hi Bitches!',
'name' => 'Monk'
);
return theme('mobile-nav', $variables);
}
/**
* Implements hook_theme();
*/
function ooyala_mobilenav_theme() {
return array(
'mobile-nav' => array(
'template' => 'mobile-nav' //Name of the tpl should be mobile-nav.tpl.php
),
'variables' => array(
'message' => '',
'name' => ''
)
);
}
//The mobile-nav.tpl.php
<h3><?php echo $message; ?> this is <?php echo $name; ?></h3>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment