You need to create a file called template-name.tpl.php
in templates
directory. Don't forget to run drush cc all
, the Drupal caching system could play with your.
Created
December 17, 2011 03:28
-
-
Save matiskay/1489044 to your computer and use it in GitHub Desktop.
A basic scaffold to use hook_theme.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_theme(). | |
* | |
* Defines the theming capabilities provided by this module. | |
*/ | |
function my_module_theme() { | |
return array( | |
'template_name' => array( | |
// In this one the rendering will be done by a tpl.php file instead of | |
// being rendered by a function, so we specify a template. | |
'template' => 'templates/template-name', | |
'variables' => array('node' => NULL), | |
), | |
); | |
} | |
function my_module_render($node) { | |
$output = ''; | |
$output .= theme('template_name', array('node' => $node)); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment