Skip to main content
2 of 2
added 645 characters in body
pico34
  • 906
  • 7
  • 13

You probably can use a theme for that

Use hook_theme() in your custom module and call the theme() function directly in your view's .tpl file

With hook_theme() your can pass arguments to an other .tpl.php file

It's probably lighter to have 8 .tpl.php files associated to hook_theme() than severals view's .tpl suggestions

An example of use of hook_theme()

/**
 * Implements hook_theme().
 */
function yourmodule_theme($existing, $type, $theme, $path) {

return array(

  'my_theme' => array(
      'template' => 'your_theme_file', //your_theme_file.tpl.php in fact
      'variables' => array(
        'your_variable' => array(),
      )
  ),
}     

Your your_theme_file.tpl.php file contains :

<?php

print '<div>'. $your_variable .'</div>

You can use this theme everywhere even in your views templates :

theme('my_theme', array('your_variable' => 'foo'));
pico34
  • 906
  • 7
  • 13