tags:

views:

37

answers:

2

I have created a module with one form in drupal.How i can give theme to the form, means applying css and all

Thanks in advance..

A: 

If you want to apply css, you should turn to your theme. Unless you do something very special, you should be fine with just using your theme.

If you want to add a css file, you can use drupal_add_css().

If you want to change the markup of your form, you can make a theming function called theme_ + the name of your form. You can also use $form['#theme'] to set the theming function for the form. In the theming function, you can change the markup as much as you like.

It's generally a good idea to use drupal_render($form) in the end of your theming function as it will print out what ever in the form that hasn't been rendered manually.

googletorp
also, the best place to put the drupal_add_css() would be in hook_init.
barraponto
@barraponto: You don't want to do that if your styles should be applied to a single form.
googletorp
@gogoletorp: where should i put it instead? also, hook_init assures the css will be compressed.
barraponto
A: 

http://data.agaric.com/node/2398 provides example on how to theme a form

Pavani
Note that that article is about Drupal 5. A number of Drupal 6 instructions and resources can be found in the comments on that page.
marcvangend

related questions