I know drupal a bit.
I am creating a custom theme and defined a region in my themename.info as
regions[search] = Search Bar
And added the below code to my page.tpl.php
<div id="search" class="search_box">
<?php if ($page['search']): ?>
<?php print render($page['search']); ?>
<?php endif; ?>
</div>
And I enabled search form via Block administration, so everything is fine now.
But, I want to create my custom search module. Please provide me some sample code, so that I can understand.
In explanation, I want to create a hook menu and function which can print what I want and also how can I enable the function to be printed on the region.
Thanks all.
In Drupal each piece of content that can be placed into a region is called a "block". So instead you want to create a Custom Block. Here's a guide, http://fourkitchens.com/blog/2012/07/18/building-custom-blocks-drupal-7.
https://drupal.org/node/1074360, Here is the Drupal module creation tutorial, the guide "generating block content" will be helpful for you.