The function sidebar() can be used to load additional data referring to a template.

Using this function loading sidebar data is the most common way, but you also can load a footer, or such, that way. :-)

sidebar(); - E.g. the current page uses a template like subpage.php instead of main.php, the function looks first for subpage.sidebar.php, if this file not exists it looks for sidebar.php and if this file not exists nothing will happen.

So the priority order is: templatename.sidebar.php, sidebar.php

sidebar("footer"); - In this example the function looks for a file footer.php