hai all,

i know drupal 6 hook mechanism.Now i have to develop one project in Drupal 5.
I have develped one module .I have not find hook_theme in Drupal 5 surprisingly . Can any one suggest me is theme machanism available in Drupal 5 if not please suggest me how to call external .tpl.php files.

By doing this i need to write all html code and assigned to $output;
like $output = '

hai

'
for this i want to use like
$output = theme(hai)

hai.tpl.php has the code

hai

please suggest me this is very much helpful for me

Comments

nevets’s picture

With Drupal 5 theming is handled with theme functions by default (you can use a tpl.php file but not directly). So calling your theme function looks like this

   ...
   $arg1 = 'hai';

   // You  can pass any number of arguments to theme()
   $output =  theme('your_theme_function', $arg1);

When you declare the function the actual name is theme_your_theme_function (the name passed to theme prefixed with 'theme_'), so it might look like

function  theme_your_theme_function($text) {
   return '<span class="some-class">' . $text . '</text>';
}

See http://drupal.org/node/11811 for overriding the theme function and using a tpl.php file.

chandra sekhar’s picture

hi

it helped me a lot and our designers

thank you very much