views:

96

answers:

1

hi,

how can I add the search field (searching for all content and tags in my webiste) to my article ?

I've already installed and activated the module, but I would like to add it to a single article instead of a block of my website

thanks

+2  A: 

There are several ways of doing searching in Drupal, but I guess you refer to the search module that's in Drupal core. It's usually used as a block which makes it a bit tricky if you want to display it with the article content.

You can use the theme function to theme a block like this:

<?php print theme('block' $block); >?

Where $block is a block object with all the data needed. To use this in your case, you could make a custom template for the article, since you only want to display the search block on one article. You would also need to make a preprocess function for the article (preprocess_node) where you create the block object. You could also just create some logic in the preprocess function and make a generic node template where you only print the block when it's there.

It is possible to control when blocks are displayed, so you could just setup your search block to only be displayed on your chosen article. That is far less work, but you wont be able to display it with the article content.

googletorp
so, it is not possible to do this from back-end ? For example adding the search field to the content type ?I have to work with php ?thanks
Patrick
It is not something you can do in a setting. Almost all theming of Drupal (controlling the markup generated by Drupal) will require some PHP.
googletorp
ok thanks. It would be nice to have a CCK Search field, integrating the search module into content types.
Patrick