I have created my own simple block.I want to show some data from user table of database of logged in user to the block.I want to show it programmatically and not want to use any module. How can I do that? One more question related to block is, can I add my custom theme to my custom block (like .tpl.php file for custom module)?If yes how can I do that?

  • blocks will follow the theme of the page - if your page uses your custom theme, so will your block
    – Geoff
    Commented May 1, 2015 at 14:16

1 Answer 1


depending on the information you want to retrieve, Views is probably your simplest option:

You need Views if

You like the default front page view, but you find you want to sort it differently. You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically. You use /tracker, but you want to restrict it to posts of a certain type. You like the idea of the 'article' module, but it doesn't display articles the way you like. You want a way to display a block with the 5 most recent posts of some particular type. You want to provide 'unread forum posts'. You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of "Month, YYYY (X)" where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month. Views can do a lot more than that, but those are some of the obvious uses of Views.

Views allows you create a block or a page in order to display formatted data.

Not the answer you're looking for? Browse other questions tagged or ask your own question.