In order to add a new theme template file (.tpl.php file), we need to implement hook_theme() in our Drupal 7 module. A theme template need to be specified in the hook_theme() function. They produce HTML and renders Drupal render array elements to the screen.
Template File
In Drupal 7, when we do customizations we would want the custom module to create content in the form of a render array. We know that a page callback should return a render array which allows the custom module to handle the content as long as possible in the page generation process. Sometimes, wrapping two render array elements together could be an easy way out while dealing with render array manipulations. Here is how we can achieve that.
You may be familiar with the theme information link in views. The theme information link in view tells us which files are to be modified, to theme the view. You could get more information regarding the view from, http://viewshelp.doc.logrus.com/help/views/analyze-theme. This is the case where we have a theme with us. But what if you don't have a theme and you still want to theme the view's result? Well, read on if you want to find out how to theme a view by adding a template file inside your custom module.