The Module Building document does a very good job of describing all the aspects of adding a block to your module, but there are some little details that may throw you into a tailspin.
There are 2 main files necessary for a block - the php file that gathers the data for displaying in your block, and the html (template) file that controls the layout of your block.
Here is the folder/file layout necessary for adding blocks - modulename/
* blocks * templates/blocks
Following the naming conventions outlined in the wiki, the filename for the block is modulename_block_blockname.php, and it should contain 2 functions - one to query the data, and one to edit the options for the block (if any). Here is one of the important tips -> the function to display the data must return a variable named $block in order for the data to be passed to the template.
Another important thing to remember is the block may be displayed in several different modules, so any includes and links should be absolute links - relative links will vary, depending on which module is displaying.











![[Main Page]](/modules/mediawiki/images/mediawiki.png)


