views:

58

answers:

2

Hi,

What is mean by the following code, I found it in the comment module (drupal 6)

return theme('box', $title, drupal_get_form('comment_form', $edit, $title));

I have used this theme function before, but I had defined some themes under hook_theme(). but I didn't see any themes defined as 'box', also I found same theme 'table'

Could you please show some urls where it explains about these things

Thank you very much

A: 

Have you already read Drupal API Reference? There's an explanation about themes, too.

Janne Pikkarainen
thanks but I didn't see theme('box'.........)
john
@John: You need to look for theme_box(). Calling theme('box'...) dispatches calls to the theme_box() "chain" of theming functions.
Aaron
Thanks very much, I found that theme('box'...) calling the file box.tpl.php under modules/system folder. but I didnt get from where theme('table'..... comes from, there must be a table.tpl.php I guess. Please let me know if you know this
john
Output for table theming is not accomplished via a template file, but through a theming function. If you want to change the html output by theme_table then you need to create a theme function override. Copy the contents of theme_table into a function called yourthemename_table and change the bits you want to change. See this for more info: https://drupal.org/node/341628
Aaron
+1  A: 

With the Drupal theme system you can overwrite theme functions. So if you don't like the markup that theme_box makes, you can make my_theme_box instead and Drupal will use that function instead. The thing is in order for this to work you can't call theme_box directly. If you do that you in your module your theme can't alter the output. Instead you call theme('box', ...) this will tell Drupal that's it's the box theming function you want. It will the find out which function to call based on what's available. So if your theme doesn't have my_theme_box defined theme_box will be used instead.

googletorp

related questions